This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Parse StrOffsets section if needed
ClosedPublic

Authored by fdeazeve on Sep 8 2023, 7:54 AM.

Details

Summary

Querying the debug_str_offsets section requires parsing the top level DIE of the
CU (as well as the section itself); the current getter, however, assumes this is
done elsewhere. This patch changes the getter behavior to match what is done in
other getter methods (e.g. getCompilationDir or getVariableForAddress), in
other words, extractDIEsIfNeeded is now called prior to returning the
debug_str_offsets contributions for the Unit.

One way in which this bug manifested is when dwarfdump --debug-str-offsets is
invoked: because the DIEs are never parsed, we incorrectly print an empty
section (with no warnings or errors).

Diff Detail

Event Timeline

fdeazeve created this revision.Sep 8 2023, 7:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2023, 7:54 AM
fdeazeve requested review of this revision.Sep 8 2023, 7:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2023, 7:54 AM
fdeazeve added a project: debug-info.
fdeazeve edited the summary of this revision. (Show Details)Sep 8 2023, 7:56 AM
fdeazeve updated this revision to Diff 556259.Sep 8 2023, 7:56 AM

Fix incorrect comment in commit message.

Please use GitHub for new patches.

aprantl accepted this revision.Sep 8 2023, 8:38 AM
aprantl added inline comments.
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
404

CUDIEOnly or CUDieOnly

This revision is now accepted and ready to land.Sep 8 2023, 8:38 AM

Please use GitHub for new patches.

Apologies, I had in my mind that September was the in-between month where both were allowed. Just re-read the discourse thread and I am indeed wrong

This revision was automatically updated to reflect the committed changes.