Revert "[flutter_tools] Dump backtrace on ios app startup timeout (#101610)" (#101761)

This reverts commit 2978b59be7.
This commit is contained in:
Christopher Fujino
2022-04-12 09:09:32 -07:00
committed by GitHub
parent 2978b59be7
commit 2a6582997d
4 changed files with 30 additions and 153 deletions

View File

@@ -434,7 +434,6 @@ class IOSDevice extends Device {
_logger.printTrace('Application launched on the device. Waiting for observatory url.');
final Timer timer = Timer(discoveryTimeout ?? const Duration(seconds: 30), () {
_logger.printError('iOS Observatory not discovered after 30 seconds. This is taking much longer than expected...');
iosDeployDebugger?.pauseDumpBacktraceResume();
});
final Uri? localUri = await observatoryDiscovery?.uri;
timer.cancel();

View File

@@ -296,23 +296,12 @@ class IOSDeployDebugger {
// (lldb) Process 6152 detached
static final RegExp _lldbProcessDetached = RegExp(r'Process \d* detached');
// (lldb) Process 6152 resuming
static final RegExp _lldbProcessResuming = RegExp(r'Process \d+ resuming');
// Send signal to stop (pause) the app. Used before a backtrace dump.
static const String _signalStop = 'process signal SIGSTOP';
static const String _processResume = 'process continue';
static const String _processInterrupt = 'process interrupt';
// Print backtrace for all threads while app is stopped.
static const String _backTraceAll = 'thread backtrace all';
/// If this is non-null, then the app process is paused and awaiting backtrace logging.
///
/// The future should be completed once the backtraces are logged.
Completer<void>? _processResumeCompleter;
/// Launch the app on the device, and attach the debugger.
///
/// Returns whether or not the debugger successfully attached.
@@ -330,6 +319,7 @@ class IOSDeployDebugger {
.transform<String>(const LineSplitter())
.listen((String line) {
_monitorIOSDeployFailure(line, _logger);
// (lldb) run
// success
// 2020-09-15 13:42:25.185474-0700 Runner[477:181141] flutter: The Dart VM service is listening on http://127.0.0.1:57782/
@@ -360,13 +350,6 @@ class IOSDeployDebugger {
// Even though we're not "detached", just stopped, mark as detached so the backtrace
// is only show in verbose.
_debuggerState = _IOSDeployDebuggerState.detached;
// If we paused the app and are waiting to resume it, complete the completer
final Completer<void>? processResumeCompleter = _processResumeCompleter;
if (processResumeCompleter != null) {
_processResumeCompleter = null;
processResumeCompleter.complete();
}
return;
}
@@ -374,12 +357,9 @@ class IOSDeployDebugger {
// The app has been stopped. Dump the backtrace, and detach.
_logger.printTrace(line);
_iosDeployProcess?.stdin.writeln(_backTraceAll);
if (_processResumeCompleter == null) {
detach();
}
detach();
return;
}
if (line.contains('PROCESS_EXITED') || _lldbProcessExit.hasMatch(line)) {
// The app exited or crashed, so exit. Continue passing debugging
// messages to the log reader until it exits to capture crash dumps.
@@ -394,13 +374,6 @@ class IOSDeployDebugger {
return;
}
if (_lldbProcessResuming.hasMatch(line)) {
_logger.printTrace(line);
// we marked this detached when we received [_backTraceAll]
_debuggerState = _IOSDeployDebuggerState.attached;
return;
}
if (_debuggerState != _IOSDeployDebuggerState.attached) {
_logger.printTrace(line);
return;
@@ -460,28 +433,11 @@ class IOSDeployDebugger {
return success;
}
/// Pause app, dump backtrace for debugging, and resume.
Future<void> pauseDumpBacktraceResume() async {
if (!debuggerAttached) {
return;
}
final Completer<void> completer = Completer<void>();
_processResumeCompleter = completer;
try {
// Stop the app, which will prompt the backtrace to be printed for all threads in the stdoutSubscription handler.
_iosDeployProcess?.stdin.writeln(_processInterrupt);
} on SocketException catch (error) {
_logger.printTrace('Could not stop app from debugger: $error');
}
// wait for backtrace to be dumped
await completer.future;
_iosDeployProcess?.stdin.writeln(_processResume);
}
Future<void> stopAndDumpBacktrace() async {
if (!debuggerAttached) {
return;
}
try {
// Stop the app, which will prompt the backtrace to be printed for all threads in the stdoutSubscription handler.
_iosDeployProcess?.stdin.writeln(_signalStop);