This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Ignore aranges starting with 0
AbandonedPublic

Authored by dangyi on Oct 24 2022, 5:35 PM.

Details

Reviewers
phosek
Summary

When --gc-sections is enabled, unused compile units will be removed
from the output but their debug info will be kept, with their starting
addresses set to 0 to indicate they are garbages. This causes symbolizer
and addr2line to fail when a large garbage DWARF unit overlaps with the
actual code.

Diff Detail

Event Timeline

dangyi created this revision.Oct 24 2022, 5:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 5:35 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
dangyi requested review of this revision.Oct 24 2022, 5:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 5:35 PM

More context is in https://fxbug.dev/112674. I've validated that the change fixed the behavior of llvm-symbolizer and llvm-addr2line.

I tried to create a test case for this but it's really awkward to write DWARF bytes to generate debug info. I could try again if it's considered necessary.

Can you add a case to llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s perhaps? A functional change like this really does need a test.

This patch actually breaks the existing test cases on symbolizer, because those test cases are based on object files rather than final binaries, and in object files ranges are started with 0.

dangyi abandoned this revision.Oct 26 2022, 5:15 PM