-
Notifications
You must be signed in to change notification settings - Fork 106
Improved Dwarf v5 support #84
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
Open
emeryberger
wants to merge
14
commits into
aclements:master
Choose a base branch
from
plasma-umass:improved_dwarf5_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Improved Dwarf v5 support #84
emeryberger
wants to merge
14
commits into
aclements:master
from
plasma-umass:improved_dwarf5_support
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Found by compiling with clang++ instead of g++.
Remove incorrect use of const
This code uses `front()` to get the underlying string buffer. However, when glibc++ assertions are enabled, this causes an assert failure if the string is empty. Since we have no need to perform the memmove if the string is empty, we can fix the crash by simply guarding with the condition `size > 0`. Note that this assert failure only occurred with glibc++ assertions enabled. Because Arch apparently enables them by default (while other distros don't), it initially appeared to be an Arch-specific problem. However, it's just that it only surfaced on Arch, while having the potential for issues on other platforms.
Guard usage of `std::string::front` for empty string
These files are normally generated by enum-print.py during Makefile builds. Including them in the repo enables CMake-based builds (like FetchContent) to work without running the Python generator. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
More Dwarf 5 support
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
DWARF 5 Rangelist Support for libelfin
This change adds support for DWARF 5 range lists (
DW_FORM::rnglistxwith.debug_rnglistssection) to libelfin.Problem
DWARF 5 binaries use a new format for range lists that differs from DWARF 4:
DW_FORM::sec_offsetpointing directly into.debug_rangesDW_FORM::rnglistxas an index into.debug_rnglists, with entries encoded usingDW_RLE_*opcodesThis caused a
value_type_mismatchexception when attempting to parse DWARF 5 range lists:Changes
dwarf/data.hhAdded
DW_RLEenum for DWARF 5 range list entry encodings (Section 7.25):dwarf/dwarf++.hhrngliststosection_typeenumis_dwarf5parameter torangelistconstructor andrangelist::iteratordwarf/elf.ccAdded section name mapping:
{".debug_rnglists", section_type::rnglists},dwarf/value.ccUpdated
as_rangelist()to handleDW_FORM::rnglistx:.debug_rnglistsheader (unit_length, version, addr_size, segment_selector_size, offset_entry_count)dwarf/rangelist.ccUpdated
rangelist::iterator::operator++()to support both formats:DW_RLE_*encoded entries including:DW_RLE_end_of_list- terminates the listDW_RLE_offset_pair- two ULEB128 offsets from baseDW_RLE_base_address- sets new base addressDW_RLE_start_end- two full addressesDW_RLE_start_length- address + ULEB128 lengthdwarf/to_string.ccAdded
to_string(DW_RLE v)for debug output.Limitations
The following
DW_RLE_*entries that require.debug_addrlookups are parsed but skipped:DW_RLE_base_addressxDW_RLE_startx_endxDW_RLE_startx_lengthFull support would require passing the compilation unit's
.debug_addrbase to the rangelist iterator.Testing
Verified with a DWARF 5 binary compiled with
g++ -gdwarf-5. The profiler now successfully parses range lists and generates valid profiles.