Skip to content

[cherry-pick][stable/20230725] [lldb][Symbol] Make sure we decrement PC before checking location list #7862

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

Michael137
Copy link

When stopping in optimized code, we can end up with the return address being the next instruction in a different block. If we are dealing with location lists, we want to decrement the PC value so it's within the calling block range that we're checking against the loclists.

This was addressed in https://reviews.llvm.org/D124597 (6e56c4961a106b8fde69ffcf9f803fe0890722fa), by introducing a GetFrameCodeAddressForSymbolication. This fixed frame variable, but expr calls into Variable::LocationIsValidForFrame, where this new API wasn't used yet.

So in the associated test-case, running frame var this works, but expr this doesn't. With dwim-print this makes the situation more surprising for the user because p this, v this and v *this work, but p *this doesn't because it falls back onto expr (due to the dereference).

This patch makes sure we lookup loclists using the correct PC by using this new GetFrameCodeAddressForSymbolication API.

@Michael137
Copy link
Author

@swift-ci test

…d platforms (llvm#74818)

The `expect_expr` check was introduced in
llvm#74772. It is failing on Linux
and Windows, so skip this test to unblock the bots

(cherry picked from commit 11a7e57)
@Michael137 Michael137 force-pushed the bugfix/lldb-loclist-cpp-member-to-20230725 branch from 9a03fdf to 4a827a0 Compare December 11, 2023 14:33
@Michael137
Copy link
Author

@swift-ci test

@Michael137
Copy link
Author

@swift-ci test

@Michael137
Copy link
Author

@swift-ci please test platform Windows

@Michael137
Copy link
Author

@swift-ci please test Windows platform

@Michael137 Michael137 merged commit d23d90c into swiftlang:stable/20230725 Dec 12, 2023
@Michael137 Michael137 deleted the bugfix/lldb-loclist-cpp-member-to-20230725 branch December 12, 2023 16:45
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