This patch extends the parsing and dumping support of llvm-dwarfdump for debug_macro.dwo section-
- DW_MACRO_define
- DW_MACRO_undef
- DW_MACRO_start_file
- DW_MACRO_end_file
- DW_MACRO_define_strx
- DW_MACRO_undef_strx
- DW_MACRO_define_strp
- DW_MACRO_undef_strp
Differential D78500
[DWARF5]:Added support for .debug_macro.dwo section in llvm-dwarfdump SouraVX on Apr 20 2020, 8:54 AM. Authored by
Details This patch extends the parsing and dumping support of llvm-dwarfdump for debug_macro.dwo section-
Diff Detail Event Timeline
Comment Actions +1 more point to be considered here is that as of now strp form in (non-split) binaries are supported by debuggers including GDB and LLDB (can expand macros in debugger correctly). But strx form is not supported in any case split or non-split. Comment Actions Addressed @dblaikie comments, thanks for this!
Comment Actions Addressed @ikudrin comments, Thanks for this!
Comment Actions I am supporting @dblaikie in that the patch should be split. The part of adding *_strx forms should be separated from adding the support of debug_macro.dwo. The parts look independent of each other and can be added in any order. And please, reduce the tests.
Comment Actions
Okay, I'll separate them, but first let us reach to a consensus on the approach used here and the way forward.
Briefly stated the reason why they are a bit long, assuming D78555 will address this, I'll be happy to reduce them to bare minimal.
Comment Actions I can't imagine how D78555 can help with that.
Comment Actions
@ikudrin, Sorry for churn :). But I'm still not getting as to how to map the indices(strx) to appropriate CU, without having to search in list(of CU's) using DW_AT_macros. dumpDWARFv5StringOffsetsSection() this function just collects the contributions from list of CU's and dump/prints it. for (auto &Contribution : Contributions) { Offset = Contribution->Base; // print dump using this as StrOffset Could you please briefly elaborate the approach you have in mind. Comment Actions The function first scans the compilation units and collects their contributions to the string offsets section. Then it scans the collected list of contributions and dumps the section according to them, detecting overlaps and gaps as a bonus. You can do the same for the macro section: scan the units, add to the list the offsets to the macro section and the corresponding contributions to the offsets section; then, go through the list, and for each item you will have both the offset in the macro section and the valid reference to the offsets section (if defined).
Comment Actions Rebased to tip!
Comment Actions Addressed @ikudrin comments, Thanks for this!
Comment Actions That was one of the reason(for adding *_strx forms dumping support) and as it seems like this whole ambiguity can be avoided(at least in LLVM) by unifying the emission of _strx forms in both split(debug_macro) and non-split(debug_macro.dwo) mode. D78865 and D78866 revisions addresses these respectively. Comment Actions I am still not really contented that there are two distinct methods to get strings from a string section in DWARFDebugMacro::parseImpl(), one for _strp codes and another for _strx. Is there a way to unify them?
Comment Actions
I'm afraid not, since _strp and _strx forms parsing is entirely different. Comment Actions Well, improving DWARFDebugMacro::parseImpl() is not really related to this particular patch. Comment Actions Looks OK - thanks! As @ikudrin mentioned, this could probably use some tidying up/refactoring after-the-fact. |
It looks like the changes in MC files should not be in this patch.