Skip to content

fix several debug info bugs#21075

Merged
andrewrk merged 6 commits intomasterfrom
fuzz
Aug 14, 2024
Merged

fix several debug info bugs#21075
andrewrk merged 6 commits intomasterfrom
fuzz

Conversation

@andrewrk
Copy link
Member

See individual commit messages.

Closes #20990

The motivating example looks a lot better in ReleaseSafe mode:

image

But it looks worse in debug mode for some reason:

image

However, I verified that our LLVM IR looks good, and our debug info logic matches GDB exactly. So, I think it's two steps forward, one step back. Remaining issues are tracked by:

The implementation assumed that compilation units did not overlap, which
is not the case. The new implementation uses .debug_ranges to iterate
over the requested PCs.

This partially resolves #20990. The dump-cov tool is fixed but the same
fix needs to be applied to `std.Build.Fuzz.WebServer` (sorting the PC
list before passing it to be resolved by debug info).

I am observing LLVM emit multiple 8-bit counters for the same PC
addresses when enabling `-fsanitize-coverage=inline-8bit-counters`. This
seems like a bug in LLVM. I can't fathom why that would be desireable.
…stEPCallback

matching the default of clang's behavior. I originally put them in
registerOptimizerEarlyEPCallback because I thought clang was doing that,
but I see now it is behind the flag `--sanitizer-early-opt-ep` which is
disabled by default.
Two fixes here:

Sort by addresses after generating the line table. Debug information in
the wild is not sorted and the rest of the implementation requires this
data to be sorted.

Handle DW.LNE.end_sequence correctly. When I originally wrote this code,
I misunderstood what this opcode was supposed to do. Now I understand
that it marks the *end* of an address range, meaning the current address
does *not* map to the current line information.

This fixes source location information for a big chunk of ReleaseSafe
code.
Unfortunately, the PCs do not get sorted during linking.
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.

-OReleaseSafe breaks fuzzing entry points feature; incorrect already-sorted assumption

1 participant