Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
832d776b
Unverified
Commit
832d776b
authored
Oct 23, 2020
by
Jenn Magder
Committed by
GitHub
Oct 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop debugger when iOS app crashes (#68844)
parent
f3562c6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
10 deletions
+41
-10
ios_deploy.dart
packages/flutter_tools/lib/src/ios/ios_deploy.dart
+8
-7
ios_deploy_test.dart
...flutter_tools/test/general.shard/ios/ios_deploy_test.dart
+33
-3
No files found.
packages/flutter_tools/lib/src/ios/ios_deploy.dart
View file @
832d776b
...
...
@@ -272,6 +272,9 @@ class IOSDeployDebugger {
// https://github.com/ios-control/ios-deploy/blob/1.11.2-beta.1/src/ios-deploy/ios-deploy.m#L51
static
final
RegExp
_lldbProcessExit
=
RegExp
(
r'Process \d* exited with status ='
);
// (lldb) Process 6152 stopped
static
final
RegExp
_lldbProcessStopped
=
RegExp
(
r'Process \d* stopped'
);
/// Launch the app on the device, and attach the debugger.
///
/// Returns whether or not the debugger successfully attached.
...
...
@@ -311,14 +314,12 @@ class IOSDeployDebugger {
}
if
(
line
.
contains
(
'PROCESS_STOPPED'
)
||
line
.
contains
(
'PROCESS_EXITED'
)
||
_lldbProcessExit
.
hasMatch
(
line
)
)
{
// The app exited or crashed, so stop echoing the output.
//
Don't pass any further ios-deploy debugging messages to the log reader after it exits.
_debuggerState
=
_IOSDeployDebuggerState
.
detached
;
_lldbProcessExit
.
hasMatch
(
line
)
||
_lldbProcessStopped
.
hasMatch
(
line
))
{
//
The app exited or crashed, so exit. Continue passing debugging
// messages to the log reader until it exits to capture crash dumps.
_logger
.
printTrace
(
line
);
if
(!
debuggerCompleter
.
isCompleted
)
{
debuggerCompleter
.
complete
(
false
);
}
exit
();
return
;
}
if
(
_debuggerState
!=
_IOSDeployDebuggerState
.
attached
)
{
...
...
packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart
View file @
832d776b
...
...
@@ -104,7 +104,10 @@ void main () {
'success'
,
// ignore first "success" from lldb, but log subsequent ones from real logging.
'Log on attach1'
,
'Log on attach2'
,
''
,
''
]);
''
,
''
,
'Log after process exit'
,
]);
});
testWithoutContext
(
'app exit'
,
()
async
{
...
...
@@ -124,7 +127,34 @@ void main () {
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
logLines
.
toList
();
expect
(
receivedLogLines
,
<
String
>[
'Log on attach'
]);
expect
(
receivedLogLines
,
<
String
>[
'Log on attach'
,
'Log after process exit'
,
]);
});
testWithoutContext
(
'app crash'
,
()
async
{
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'ios-deploy'
],
stdout:
'(lldb) run
\r\n
success
\r\n
Log on attach
\r\n
(lldb) Process 6156 stopped
\r\n
* thread #1, stop reason = Assertion failed:'
,
),
]);
final
IOSDeployDebugger
iosDeployDebugger
=
IOSDeployDebugger
.
test
(
processManager:
processManager
,
logger:
logger
,
);
final
List
<
String
>
receivedLogLines
=
<
String
>[];
final
Stream
<
String
>
logLines
=
iosDeployDebugger
.
logLines
..
listen
(
receivedLogLines
.
add
);
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
logLines
.
toList
();
expect
(
receivedLogLines
,
<
String
>[
'Log on attach'
,
'* thread #1, stop reason = Assertion failed:'
,
]);
});
testWithoutContext
(
'attach failed'
,
()
async
{
...
...
@@ -196,7 +226,7 @@ void main () {
expect
(
logger
.
errorText
,
contains
(
'Your device is locked.'
));
});
testWithoutContext
(
'
device locked
'
,
()
async
{
testWithoutContext
(
'
unknown app launch error
'
,
()
async
{
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'ios-deploy'
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment