Skip to content

[lldb][swift] Improve async stepping with arm64e #10671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

felipepiovezan
Copy link

@felipepiovezan felipepiovezan commented May 13, 2025

(review each commit in isolation)

This PR improves arm64e swift async stepping by:

  1. Restoring a former heuristic responsible for recovering the async context in "Q" funcelts (async indirect ABI). This is done only for arm64e.
  2. Calling Process::Fix{data,code}Address in a few locations that extract addresses from memory reads.

@felipepiovezan felipepiovezan requested a review from a team as a code owner May 13, 2025 00:17
@felipepiovezan
Copy link
Author

@swift-ci test

@felipepiovezan felipepiovezan changed the title [lldb][swift] Change unwind heuristic for Q funcets in arm64e [lldb][swift] Change unwind heuristic for Q funclets in arm64e May 13, 2025
With arm64e, many more branches are generated, which cause the debugger
to stop more often while stepping. Among those stops are code regions
where the debugger gets confused about what is stored in the async
register stack slot.

This commit revives a heuristic that was previously used by default for
all architectures and that works in all PC addresses, but that
sacrifices unwinding o recursive functions. It is only used if the
target is arm64e.
…geRuntime

This is required so that the breakpoint may be resolved correctly in
case the address has been signed.
@felipepiovezan felipepiovezan force-pushed the felipe/arm64e_unwind_heuristic branch from f93e511 to be2f5ca Compare May 13, 2025 20:14
@felipepiovezan felipepiovezan changed the title [lldb][swift] Change unwind heuristic for Q funclets in arm64e [lldb][swift] Improve async stepping with arm64e May 13, 2025
@felipepiovezan
Copy link
Author

@swift-ci test

The code comparing async context addresses need to strip any pointer
authentication bits, otherwise the integer comparison will always fail.
@felipepiovezan felipepiovezan force-pushed the felipe/arm64e_unwind_heuristic branch from be2f5ca to 6e361c7 Compare May 13, 2025 21:18
@@ -76,25 +76,27 @@ struct MockStackID : StackID {
};

TEST_F(StackIDTest, StackStackCFAComparison) {
auto process = MockProcess(m_target_sp, Listener::MakeListener("dummy"));
Copy link
Author

@felipepiovezan felipepiovezan May 13, 2025

Choose a reason for hiding this comment

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

In case you're puzzled by this change: FixDataAddress indirectly calls "shared_from_this" on the process class, so it can't be stack allocated.

@felipepiovezan
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit 74f18b3 into swiftlang:swift/release/6.2 May 14, 2025
3 checks passed
@felipepiovezan felipepiovezan deleted the felipe/arm64e_unwind_heuristic branch May 14, 2025 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants