[PATCH] D87601: [obj2yaml] Add support for dumping the .debug_addr(v5) section.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 03:23:18 PDT 2020


grimar added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp:187
+  return Addrs;
+}
----------------
All these getters are short. I'd just implement them in the header file.


================
Comment at: llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml:182
+
+## c) Test dumping a address table whose version isn't 5.
+## This makes the DWARF parser fail to parse it and we will dump it as a raw
----------------
a->an


================
Comment at: llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml:207
+  debug_addr:
+    - Version: 4
+
----------------
I wonder if instead we should just provide a section description with an arbitrary unsupported content.
E.g:

```
Sections:
  - Name: .debug_addr
    Content: "AABBCC"
```


================
Comment at: llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml:224
+DWARF:
+  debug_addr: []
----------------
I'd probably use

```
Sections:
  - Name: .debug_addr
    Size: 0
```

It is a bit more straighforward way to describe an empty section and still
allows to observe obj2yaml produce an DWARF entry instead of a section declaration.


================
Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:78
+    AddrTables.back().SegSelectorSize = AddrTable.getSegmentSelectorSize();
+    AddrTables.back().SegAddrPairs = Entries;
+  }
----------------
I think you can avoid having `Entries` and insert directly to `SegAddrPairs`?


================
Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:80
+  }
+  Y.DebugAddr = AddrTables;
+  return Error::success();
----------------
You can avoid copying a vector with

```
Y.DebugAddr = std::move(AddrTables);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87601



More information about the llvm-commits mailing list