[PATCH] D73086: [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
Tue Feb 18 15:11:40 PST 2020


SouraVX marked an inline comment as done.
SouraVX added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp:91-97
+      // Contribution of one CU finished, dump this and
+      // check if Offset is still valid, if so, start parsing/dumping
+      // debug_macro again.This is not needed for debug_macinfo section since
+      // contribution from different CU's got merged into single debug_macinfo
+      // section with macro termination sequence at the end of the section.
+      if (getVersion() >= 5)
+        return;
----------------
dblaikie wrote:
> I can't seem to make sense of this comment. Both the commend and the code seem incorrect to me - there should still be one debug_macro contribution per-CU in DWARFv5 (it'd not be possible for there to be only one across all CUs without DWARF-aware linking, which is something the DWARF spec tries very hard to not require)
> 
> Have you tried compiling two files with DWARFv5 debug_macro contents using your prototype patches & then looking at the result? I would expect there should be two debug_macro contributions, and that this functionality as currently commented/written would only dump one of them.
Apologies for the confusion here, Yes I've tested the generation/ dumping using dwarfdump even with objdump rigorously.
This work flawlessly for multipe CU case. 
Snippet from dump taken just now 2 CU --
```
.debug_macro contents:
0x00000000: macro header: version = 0x0005, flags = 0x02, debug_line_offset = 0x0000
DW_MACRO_start_file - lineno: 0 filenum: 0
  DW_MACRO_define_strp - lineno: 1 macro: BAR 4
DW_MACRO_end_file
DW_MACRO_define_strp - lineno: 0 macro: __llvm__ 1

0080a: macro header: version = 0x0005, flags = 0x02, debug_line_offset = 0x0067
DW_MACRO_start_file - lineno: 0 filenum: 0
  DW_MACRO_define_strp - lineno: 1 macro: BAR 4
DW_MACRO_end_file
DW_MACRO_define_strp - lineno: 0 macro: __llvm__ 1
```
I've crossed checked these macro and debug_line offsets with objdump also using same binary. matches!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73086/new/

https://reviews.llvm.org/D73086





More information about the llvm-commits mailing list