Skip to content

Manually stop and continue LLDB breakpoints on Xcode 26.4+#184690

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
vashworth:jit_26_4_workaround
Apr 8, 2026
Merged

Manually stop and continue LLDB breakpoints on Xcode 26.4+#184690
auto-submit[bot] merged 5 commits into
flutter:masterfrom
vashworth:jit_26_4_workaround

Conversation

@vashworth

@vashworth vashworth commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

When using LLDB to debug on a physical iOS device, we use LLDB breakpoints for JIT. However, it appears that LLDB fails to stop at the breakpoint sometimes. To workaround this, when using Xcode 26.4+, we don't use the LLDB auto-continue feature and instead wait for it to stop and restart it manually using the continue command.

Fixes #184254.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@vashworth vashworth requested review from a team as code owners April 6, 2026 21:40
@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 6, 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 updates the IOSCoreDeviceLauncher and LLDB classes to incorporate an Xcode dependency, allowing for version-specific behavior during the iOS device attachment process. Specifically, it introduces a condition to skip breakpoint initialization when the Xcode version is 26.4.0. Review feedback indicates that the version number 26.4.0 is likely a typo and suggests implementing a more robust version range check. Additionally, it is recommended to replace the force-unwrap operator on the global Xcode instance with safer null handling to avoid potential runtime crashes.

Comment thread packages/flutter_tools/lib/src/ios/lldb.dart Outdated
Comment thread packages/flutter_tools/lib/src/macos/xcdevice.dart Outdated
@vashworth vashworth changed the title skip LLDB breakpoint on Xcode 26.4 Manually stop and continue LLDB JIT breakpoints on Xcode 26.4+ Apr 7, 2026
@vashworth vashworth added the CICD Run CI/CD label Apr 7, 2026
@vashworth vashworth requested a review from okorohelijah April 7, 2026 17:31
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 7, 2026
@vashworth vashworth added the CICD Run CI/CD label Apr 7, 2026
r"breakpoint set --func-regex '^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$'",
);
final Version? xcodeVersion = _xcode.currentVersion;
final bool useManualContinue = xcodeVersion != null && (xcodeVersion >= Version(26, 4, 0));

@okorohelijah okorohelijah Apr 7, 2026

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.

since the tradeoff is slower, can we maybe add a tracking issue in the case where apple fixes the bug to ensure we can revert to the auto-continue when it is fixed

@vashworth vashworth Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can file one after. I don't think it needs to be committed in the code since there's no clear TODO

}
// If the last log was a proces stop log, check if it was caused by a breakpoint.
if (processStopLine != null) {
if (line.contains('stop reason = 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.

instead of manual string matching, should we consider using a regex pattern for stop reason = breakpoint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What benefit would regex give here? To match on inconsistent spacing?

@okorohelijah okorohelijah Apr 7, 2026

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.

yup but also to avoid false positives in cases where there might be similar string

@okorohelijah okorohelijah 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.

LGTM overall

@vashworth vashworth changed the title Manually stop and continue LLDB JIT breakpoints on Xcode 26.4+ Manually stop and continue LLDB breakpoints on Xcode 26.4+ Apr 7, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 7, 2026
@vashworth vashworth added the CICD Run CI/CD label Apr 7, 2026
@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 7, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Apr 8, 2026
Merged via the queue into flutter:master with commit 3c61c77 Apr 8, 2026
139 of 140 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2026
final bool useManualContinue = xcodeVersion != null && (xcodeVersion >= Version(26, 4, 0));
final breakpointSetCommand = useManualContinue
? r"breakpoint set --func-regex '^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$'"
: r"breakpoint set --auto-continue true --func-regex '^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$'";

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.

i may be missing something, but why is it changing behavior for earlier versions (pre-26.4)?

Before:
breakpoint set --func-regex '^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$'

After:
breakpoint set --auto-continue true --func-regex '^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$'

auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 8, 2026
flutter/flutter@a0924c7...05e0ae0

2026-04-08 [email protected] Fix Android engine flags defaulting to true for malformed values (flutter/flutter#184631)
2026-04-08 [email protected] Try one more again (flutter/flutter#184767)
2026-04-08 [email protected] Remove custom `analysis_options.yaml` from `imitation_game_flutter` (flutter/flutter#184717)
2026-04-08 [email protected] Add more error handling to unawaited callsites (flutter/flutter#184526)
2026-04-08 [email protected] Refactor: remove material from absorb_ponter_test, container_test,  lookup_boundary_test, page_view_test, router_test, semantics_clipping_test, semantics_merge_test, shadow_test, text_test (flutter/flutter#183309)
2026-04-08 [email protected] Remove editable_text_utils cross-imports from material and cupertino … (flutter/flutter#184519)
2026-04-08 [email protected] Replace hard coded max path length with system defined one. (flutter/flutter#184697)
2026-04-08 [email protected] [Re-land] Add Support For Built-in Kotlin (flutter/flutter#184745)
2026-04-08 [email protected] Manually stop and continue LLDB breakpoints on Xcode 26.4+ (flutter/flutter#184690)
2026-04-08 [email protected] Code freeze workflow (flutter/flutter#184246)
2026-04-08 [email protected] [Dot shorthands] Migrate examples/api/lib/widgets (flutter/flutter#183965)
2026-04-08 [email protected] [cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (flutter/flutter#182036)
2026-04-08 [email protected] [Semantics] clarify Android header docs (flutter/flutter#183573)
2026-04-08 [email protected] [ci] mac build_test bringup false (flutter/flutter#184738)
2026-04-08 [email protected] Reland "Apply rect clipping to surface views" (flutter/flutter#184732)
2026-04-08 [email protected] Remove bringup label for resharded Windows tool_integration_tests shards (flutter/flutter#184721)
2026-04-08 [email protected] Tool: Add search and filtering to widget preview scaffold (flutter/flutter#184023)
2026-04-08 [email protected] Update localization from translation console (flutter/flutter#184742)
2026-04-07 [email protected] Revert "Add Support For Built-in Kotlin (#184227)" (flutter/flutter#184739)
2026-04-07 [email protected] Collect HCPP adoption analytics for flutter run/build apk/build appbundle (flutter/flutter#184225)
2026-04-07 [email protected] Add a github workflow for reverting PRs. (flutter/flutter#184593)
2026-04-07 [email protected] Add Support For Built-in Kotlin (flutter/flutter#184227)
2026-04-07 [email protected] Revert "Apply rect clipping to surface views (#184471)" (flutter/flutter#184728)
2026-04-07 [email protected] [Fix-forward] Added Compose plugin to Add-to-app Integration Test (flutter/flutter#184681)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
realmeylisdev added a commit to realmeylisdev/flutter that referenced this pull request Apr 11, 2026
…#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
mbcorona pushed a commit to mbcorona/flutter that referenced this pull request Apr 15, 2026
…84690)

When using LLDB to debug on a physical iOS device, we use LLDB
breakpoints for JIT. However, it appears that LLDB fails to stop at the
breakpoint sometimes. To workaround this, when using Xcode 26.4+, we
don't use the LLDB auto-continue feature and instead wait for it to stop
and restart it manually using the `continue` command.

Fixes flutter#184254.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@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 CICD Run CI/CD 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

6 participants