@@ -288,9 +288,10 @@ class IOSDeployDebugger {
288
288
bool get debuggerAttached => _debuggerState == _IOSDeployDebuggerState .attached;
289
289
_IOSDeployDebuggerState _debuggerState;
290
290
291
- // (lldb) run
292
- // https://github.com/ios-control/ios-deploy/blob/1.11.2-beta.1/src/ios-deploy/ios-deploy.m#L51
293
- static final RegExp _lldbRun = RegExp (r'\(lldb\)\s*run' );
291
+ // (lldb) platform select remote-'ios' --sysroot
292
+ // https://github.com/ios-control/ios-deploy/blob/1.11.2-beta.1/src/ios-deploy/ios-deploy.m#L33
293
+ // This regex is to get the configurable lldb prompt. By default this prompt will be "lldb".
294
+ static final RegExp _lldbPlatformSelect = RegExp (r"\s*platform select remote-'ios' --sysroot" );
294
295
295
296
// (lldb) run
296
297
// https://github.com/ios-control/ios-deploy/blob/1.11.2-beta.1/src/ios-deploy/ios-deploy.m#L51
@@ -324,6 +325,11 @@ class IOSDeployDebugger {
324
325
/// Returns whether or not the debugger successfully attached.
325
326
Future <bool > launchAndAttach () async {
326
327
// Return when the debugger attaches, or the ios-deploy process exits.
328
+
329
+ // (lldb) run
330
+ // https://github.com/ios-control/ios-deploy/blob/1.11.2-beta.1/src/ios-deploy/ios-deploy.m#L51
331
+ RegExp lldbRun = RegExp (r'\(lldb\)\s*run' );
332
+
327
333
final Completer <bool > debuggerCompleter = Completer <bool >();
328
334
try {
329
335
_iosDeployProcess = await _processUtils.start (
@@ -336,10 +342,30 @@ class IOSDeployDebugger {
336
342
.transform <String >(const LineSplitter ())
337
343
.listen ((String line) {
338
344
_monitorIOSDeployFailure (line, _logger);
345
+
346
+ // (lldb) platform select remote-'ios' --sysroot
347
+ // Use the configurable custom lldb prompt in the regex. The developer can set this prompt to anything.
348
+ // For example `settings set prompt "(mylldb)"` in ~/.lldbinit results in:
349
+ // "(mylldb) platform select remote-'ios' --sysroot"
350
+ if (_lldbPlatformSelect.hasMatch (line)) {
351
+ final String platformSelect = _lldbPlatformSelect.stringMatch (line) ?? '' ;
352
+ if (platformSelect.isEmpty) {
353
+ return ;
354
+ }
355
+ final int promptEndIndex = line.indexOf (platformSelect);
356
+ if (promptEndIndex == - 1 ) {
357
+ return ;
358
+ }
359
+ final String prompt = line.substring (0 , promptEndIndex);
360
+ lldbRun = RegExp (RegExp .escape (prompt) + r'\s*run' );
361
+ _logger.printTrace (line);
362
+ return ;
363
+ }
364
+
339
365
// (lldb) run
340
366
// success
341
367
// 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/
342
- if (_lldbRun .hasMatch (line)) {
368
+ if (lldbRun .hasMatch (line)) {
343
369
_logger.printTrace (line);
344
370
_debuggerState = _IOSDeployDebuggerState .launching;
345
371
return ;
0 commit comments