Visitar URL original
Disable LLDB async mode to fix breakpoint race on Xcode 26.4+ by realmeylisdev · Pull Request #184907 · flutter/flutter · GitHub
Skip to content

Disable LLDB async mode to fix breakpoint race on Xcode 26.4+ - #184907

Closed
realmeylisdev wants to merge 2 commits into
flutter:masterfrom
realmeylisdev:fix/184254-lldb-setasync-false
Closed

realmeylisdev wants to merge 2 commits into
flutter:masterfrom
realmeylisdev:fix/184254-lldb-setasync-false

Conversation

@realmeylisdev

Copy link
Copy Markdown
Contributor

Summary

Re-lands the SetAsync(False) fix for the LLDB breakpoint race condition on Xcode 26.4+ that causes EXC_BAD_ACCESS crashes on DartWorker threads (~80% failure rate on USB debug launches).

Root cause (confirmed by @mraleph): Xcode 26.4's LLDB randomly fails to rearm the scripted breakpoint on NOTIFY_DEBUGGER_ABOUT_RX_PAGES after it fires. Upstream bug: llvm/llvm-project#190956

Fixes #184254

Files changed

File Change
lldb.dart Add SetAsync(False), revert to simple log forwarding, update resume pattern
core_devices.dart Remove unused xcode param from IOSCoreDeviceLauncher
xcdevice.dart Remove xcode arg from IOSCoreDeviceLauncher() call
lldb_test.dart Update tests for sync mode, add SetAsync(False) verification, remove obsolete tests
core_devices_test.dart Remove xcode: FakeXcode() from all launcher calls

Test plan

  • All 12 LLDB unit tests pass
  • All 75 core_devices unit tests pass
  • dart analyze clean on all modified files
  • Manual: 20+ consecutive flutter run launches on physical iOS device via USB with Xcode 26.4

…#184254)

Xcode 26.4's LLDB has a race condition where breakpoints randomly fail
to rearm after firing, causing EXC_BAD_ACCESS crashes on DartWorker
threads (~80% failure rate). This disables LLDB's async mode via
SetAsync(False) so breakpoint events are processed sequentially,
eliminating the race.

This re-lands the approach from flutter#184768 (reverted in flutter#184868 due to
test failures) with corrected tests that expect synchronous mode
output ('location added to breakpoint' instead of 'Process X resuming').

Also removes the manual stop/continue workaround from flutter#184690 and the
Xcode version dependency from the LLDB class, since SetAsync(False)
is safe on all LLDB versions.

Upstream bug: llvm/llvm-project#190956
@realmeylisdev
realmeylisdev requested review from a team as code owners April 11, 2026 03:55
@github-actions github-actions Bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop team-ios Owned by iOS platform team team-macos Owned by the macOS platform team platform-macos labels Apr 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the Xcode dependency from IOSCoreDeviceLauncher and LLDB, simplifying the initialization and breakpoint logic. It switches LLDB to synchronous mode using SetAsync(False) to address rearming issues and updates the process resumption detection to match breakpoint location additions. Feedback suggests refining the new resumption regex to be more specific and removing redundant blank lines in test files to maintain code cleanliness.

/// to be added, which indicates the process is running.
///
/// Example: (lldb) 1 location added to breakpoint 1
static final _lldbProcessResuming = RegExp(r'location added to breakpoint');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regex _lldbProcessResuming has been updated to match location added to breakpoint. While this works as a signal that the attach sequence is progressing in synchronous mode, it is quite broad. If multiple breakpoints are ever used, this might match prematurely or multiple times. Consider if a more specific pattern (e.g., matching the specific breakpoint ID or function name) would be more robust for future-proofing.

Comment on lines 81 to 82

coreDeviceControl: fakeCoreDeviceControl,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The removal of the xcode parameter has left an unnecessary blank line (likely containing indentation whitespace). This pattern repeats throughout the file (e.g., lines 108, 137, 162, etc.). Removing these extra lines will improve code cleanliness and better align with dart format expectations.

Suggested change
coreDeviceControl: fakeCoreDeviceControl,
coreDeviceControl: fakeCoreDeviceControl,
References
  1. Optimize for readability: Code is read more often than it is written. (link)

- Make _lldbProcessResuming regex more specific (\d+ location added to
  breakpoint \d+) to match the specificity already used in _ignorePatterns
- Remove 20 stray blank lines in core_devices_test.dart left from xcode
  parameter removal
@vashworth

Copy link
Copy Markdown
Contributor

Thank you for the contribution. This issue has already been fixed in #184970.

@vashworth vashworth closed this Apr 15, 2026
@stuartmorgan-g stuartmorgan-g added platform-macos Building on or for macOS specifically and removed platform-macos labels Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop platform-ios iOS applications specifically platform-macos Building on or for macOS specifically team-ios Owned by iOS platform team team-macos Owned by the macOS platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thread DartWorker crash EXC_BAD_ACCESS on macOS/iOS/Xcode 26.4 in debug mode on physical devices

3 participants