[cherry-pick][stable/20230725] [lldb][Symbol] Make sure we decrement PC before checking location list #7862
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aGetFrameCodeAddressForSymbolication
. This fixedframe variable
, butexpr
calls intoVariable::LocationIsValidForFrame
, where this new API wasn't used yet.So in the associated test-case, running
frame var this
works, butexpr this
doesn't. Withdwim-print
this makes the situation more surprising for the user becausep this
,v this
andv *this
work, butp *this
doesn't because it falls back ontoexpr
(due to the dereference).This patch makes sure we lookup loclists using the correct PC by using this new
GetFrameCodeAddressForSymbolication
API.