[PATCH] D78736: [DWARF5]: Added support for dumping strx forms in llvm-dwarfdump
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 24 08:04:33 PDT 2020
ikudrin added a comment.
The test should be reduced.
================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp:306
+ // FIXME: Add support for debug_macro.dwo section.
+ Units = normal_units();
+ }
----------------
You do not need type units to parse the macro section. It is better to pass `compile_units()`.
================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp:104
+ if (auto CUDIE = U->getUnitDIE())
+ MacroToSrOffets.insert(
+ {*toSectionOffset(CUDIE.find(DW_AT_macros)),
----------------
Not all units may reference the macro section. You should skip such units.
================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp:166-171
+ uint64_t StrOffsetBase = GetStrOffsetBase();
+ E.Line = Data.getULEB128(&Offset);
+ uint64_t OffsetIndex = Data.getULEB128(&Offset);
+ uint64_t IndexOffset = StrOffsetBase + OffsetIndex * /*EntrySize=*/4;
+ uint64_t StrOffset = StringOffsetsExtractor.getValue().getRelocatedValue(
+ /*OffsetSize=*/4, &IndexOffset);
----------------
`DWARFUnit` provides a method for that, `getStringOffsetSectionItem()`. Please, use it.
By the way, the string extractor can also be obtained from `DWARFUnit` using the `getStringExtractor()` method.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78736/new/
https://reviews.llvm.org/D78736
More information about the llvm-commits
mailing list