Skip to content

[lldb][DWARF] Sort ranges list in dwarf 5. (#91343) #8747

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

Merged

Conversation

bulbazord
Copy link

Dwarf 5 says "There is no requirement that the entries be ordered in any particular way" in 2.17.3 Non-Contiguous Address Ranges for rnglist. Some places assume the ranges are already sorted but it's not.

For example, when parsing function
info
, it validates low and hi address of the function: GetMinRangeBase returns the first range entry base and GetMaxRangeEnd returns the last range end. If low >= hi, it stops parsing this function. This causes missing inline stack frames for those functions.

This change fixes it and updates the test
lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists.s so that two ranges in .debug_rnglists are out of order and image lookup -v -s lookup_rnglists is still able to produce sorted ranges for the inner block.

(cherry picked from commit fdede92)

Dwarf 5 says "There is no requirement that the entries be ordered in any
particular way" in 2.17.3 Non-Contiguous Address Ranges for rnglist.
Some places assume the ranges are already sorted but it's not.

For example, when [parsing function
info](https://github.com/llvm/llvm-project/blob/bc8a42762057d7036f6871211e62b1c3efb2738a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L922-L927),
it validates low and hi address of the function: GetMinRangeBase returns
the first range entry base and GetMaxRangeEnd returns the last range
end. If low >= hi, it stops parsing this function. This causes missing
inline stack frames for those functions.

This change fixes it and updates the test
`lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists.s` so that two
ranges in `.debug_rnglists` are out of order and `image lookup -v -s
lookup_rnglists` is still able to produce sorted ranges for the inner
block.

(cherry picked from commit fdede92)
@bulbazord bulbazord requested a review from adrian-prantl May 13, 2024 21:31
@bulbazord
Copy link
Author

@swift-ci please test

@adrian-prantl adrian-prantl merged commit 9e23627 into swiftlang:swift/release/6.0 May 14, 2024
3 checks passed
@bulbazord bulbazord deleted the sorted-ranges-list-6.0 branch May 14, 2024 18:13
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.

3 participants