Repository navigation
Conversation
snehasish
self-requested a review
September 25, 2026 15:54
Collaborator
|
Can you rebase to resolve the conflict so that I can approve the test workflows? |
anatasluo
force-pushed
the
fix-dwarf5-line-table
branch
from
September 30, 2026 16:09
a823ad8 to
9b75318
Compare
Contributor
Author
@snehasish Rebased onto master and resolved the conflict. I had rebased #268 first because the two PRs conflict with each other. I'll rebase #269 again once #268 is merged. Thanks for your patience. |
The DWARF5 support added in dd1395a passes .debug_line_str in place of .debug_str and .debug_str_offsets at both line-reader call sites. Indirect paths can resolve to the wrong strings, or access a missing section. The ELF loader also omits .debug_str_offsets. Pass each section from its own lookup and load .debug_str_offsets. Add a regression using distinct section contents to check strp and strx paths through both handlers. Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
The DWARF5 line reader added in dd1395a accepts only path and directory-index fields. Valid timestamps, sizes and MD5 checksums make it reject the table, so Clang MD5 entries produce no source lines. Read integer timestamps and sizes, consume data16 checksums, and allow all five standard file fields. Add a compact regression checking decoded metadata, cursor alignment and truncated input. Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
anatasluo
force-pushed
the
fix-dwarf5-line-table
branch
from
September 30, 2026 17:51
9b75318 to
8273ba0
Compare
Contributor
Author
|
Hi, @snehasish . I've rebased this again after #268 merged, and there are no remaining conflicts. Could you approve the CI workflows and review when you have a chance? Thanks! |
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
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.
This PR fixes two DWARF5 reader issues introduced in dd1395a,
kept as separate commits:
Google3Addr2line::Prepare()omits.debug_str_offsets. Bothline-reader call sites also use the
.debug_line_striterator whenretrieving the
.debug_strand.debug_str_offsetsbuffers,causing incorrect string lookups. If
.debug_stris present but.debug_line_stris absent, this can dereference the section map'send iterator, which is undefined behavior.
Load
.debug_str_offsetsand pass each section's own buffer and size.The DWARF5 line reader accepts only path and directory-index fields,
rejecting valid tables containing timestamps, sizes or MD5 checksums.
Read integer timestamps and sizes, consume
DW_FORM_data16MD5 fieldswithout interpreting the digest, and allow all five standard file
fields. File and directory indexing is unchanged.
Validation
A small Clang 22.1.8-generated DWARF5 binary triggers a missing
string-offsets check before the first fix. With only the first commit,
parsing proceeds but the MD5-bearing line table yields no source lines.
With both commits, the queried function and source line match GNU
addr2line. GCC-generated DWARF4 and DWARF5 controls are unchanged.
The two new regressions fail before their respective fixes. They cover
strp/strx1lookups through both handlers, decoded file metadata,cursor alignment and truncated input.
All seven
addr2line_testcases pass with Clang 22.1.8 and GCC 16.2.1.Targeted ASan/UBSan checks also pass.