[PATCH] D78782: Add .debug_ranges support to the DWARF YAML.

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 05:22:25 PDT 2020


labath edited reviewers, added: jhenderson; removed: labath.
labath added a comment.

I don't think I am a good person to review this, as so far, I haven't found the current dwarfyaml representation to be particularly useful. I've left some comments inline.



================
Comment at: llvm/include/llvm/ObjectYAML/DWARFYAML.h:75-76
+struct RangeDescriptor {
+  llvm::yaml::Hex64 LowOffset; ///< Offset from the CU base address.
+  llvm::yaml::Hex64 HighOffset; ///< Offset from the CU base address.
+};
----------------
The comments aren't really correct, because the range lists can also contain base address selection entries (low = 0xffff, high = base), and subsequent entries are then relative to that.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:121
+    const size_t CurrOffset = OS.tell() - RangesOffset;
+    if (Ranges.Offset > CurrOffset)
+        ZeroFillBytes(OS, Ranges.Offset - CurrOffset);
----------------
What if `Ranges.Offset` is strictly less than CurrOffset? Should that assert or something?


================
Comment at: llvm/lib/ObjectYAML/DWARFYAML.cpp:88
+  IO.mapRequired("AddrSize", Ranges.AddrSize);
+  IO.mapRequired("Descriptors", Ranges.Descriptors);
+}
----------------
DWARF4 spec calls these "entries". You probably copied these from the "descriptors" for aranges, but it looks like there is already a precedent for the term "Entries"  in the "Pubsection" code a couple of lines lower.


================
Comment at: llvm/test/tools/obj2yaml/macho-DWARF-debug-ranges.yaml:6-31
+# 0x0000000b: DW_TAG_compile_unit
+#               DW_AT_name        ("/tmp/main.c")
+#               DW_AT_language    (DW_LANG_C_plus_plus)
+#               DW_AT_low_pc      (0x0000000000000000)
+#               DW_AT_ranges      (0x00000000
+#                  [0x0000000000000000, 0x0000000000000020)
+#                  [0x0000000000000000, 0x0000000000000030)
----------------
As you have spelled this out anyway, maybe you could just make this into an actual check (by running llvm-dwarfdump on the intermediate object file).


================
Comment at: llvm/test/tools/obj2yaml/macho-DWARF-debug-ranges.yaml:254-294
+  debug_line:
+    - Length:
+        TotalLength:     66
+      Version:         2
+      PrologueLength:  34
+      MinInstLength:   1
+      DefaultIsStmt:   1
----------------
It doesn't look like the line section is needed to test this functionality.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78782





More information about the llvm-commits mailing list