[PATCH] D73086: [WIP][DWARF5] Added support for debug_macro section parsing and dumping in llvm-dwarfdump.
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 13 06:22:13 PDT 2020
SouraVX added a comment.
@jhenderson Thanks for sharing pseudo code!
I forgot to mention this thing in our last discussion of refactoring the code shared by macro/macinfo. `macro` and `macinfo` are represented differently(due to their contents) to be specific `DWARFSection ` and `StringRef` explicitly as a result we can't share extract `DWARFDataExtractor` the using same way. --
`DWARFDataExtractor Data(Macinfo, LittleEndian, 0); `-- this only works for macinfo
for macro you also need DWARFObject
`DWARFDataExtractor MacroData(*DObj, DObj->getMacroSection(), isLittleEndian(), 0);` -- only works for macro section.
+ ` SectionT &MacroSection` argument will be `const llvm::DWARFSection&` -- for macro case
and `StringRef` --for macinfo case.
code bloating a lot -- psuedo code not compilable, -- sort of need one more extra argument to fetch information from `macinfo` section (StringRef)
template<typename DWARFDebugT, typename SectionT>
static Expected<const DWARFDebugT*> getDWARFDebugMacro(
const DWARFObject &DObj,
std::unique_ptr<DWARFDebugT> &MacroPtr,
SectionT &MacroSection,
bool LittleEndian,
bool IsMacro,
DataExtractor StringExtractor) {
if (MacroPtr)
return MacroPtr.get();
if (IsMacro) {
DWARFDataExtractor MacroData(DObj, MacroSection, LittleEndian, 0);
if (Error Err = MacroPtr->parse(StringExtractor, MacroData, IsMacro)) {
Macro.reset();
return std::move(Err);
}
else {
DWARFDataExtractor MacinfoData(MacroSection, LittleEndian, 0);
MacroPtr.reset(new DWARFDebugT());
if (Error Err = MacroPtr->parse(StringExtractor, MacinfoData, IsMacro)) {
Macro.reset();
return std::move(Err);
}
return MacroPtr.get();
}
}
}
Do you still vote for this ? Please share!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73086/new/
https://reviews.llvm.org/D73086
More information about the llvm-commits
mailing list