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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 01:12:46 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/include/llvm/ObjectYAML/DWARFYAML.h:75
+/// Class that describes a range list entry, or a base address selection entry
+/// within a range list in the .debug_ranges section
+struct RangeEntry {
----------------
Nit: missing full stop.


================
Comment at: llvm/test/tools/obj2yaml/macho-DWARF-debug-ranges.yaml:135
+        reserved3:       0x00000000
+        content:         002F746D702F6D61696E2E630073747269707065643100737472697070656432006D61696E00
+  - cmd:             LC_SYMTAB
----------------
clayborg wrote:
> Higuoxing wrote:
> > `__debug_str`'s content can also be placed in `DWARF` entry below, which is easier to read and write.
> > 
> > ```
> > DWARF:
> >   debug_str:
> >     - ''
> >     - /tmp/main.c
> >     - stripped
> >     - stripped2
> >     - main
> > ```
> This is how obj2yaml converted my original mach-o file so I can't remove it.
It sounds like obj2yaml for Mach-O (and COFF for that matter) is in dire need of cleaning up, so that it is more useful for minimal inputs.

For example, as @Higuoxing's and my own confusion have pointed out, it doesn't seem right that there is both section content and DWARF data describing the same thing. Which is the source of truth after all?

Not an issue for this patch of course.


================
Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:95-96
+    else if (CUAddrSize != AddrSize)
+      return createStringError(std::errc::invalid_argument,
+                               "address sizes vary in different compile units");
+  }
----------------
Test case?


================
Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:110
+      return E;
+    for (const auto &RLE: DwarfRanges.getEntries())
+      YamlRanges.Entries.push_back({RLE.StartAddress, RLE.EndAddress});
----------------
The linter is still complaining about clang-format on this line.


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