This is an archive of the discontinued LLVM Phabricator instance.

[obj2yaml] Add support for dumping the .debug_addr(v5) section.
ClosedPublic

Authored by Higuoxing on Sep 14 2020, 1:30 AM.

Details

Summary

This patch adds support for dumping the .debug_addr(v5) section to
obj2yaml.

Diff Detail

Event Timeline

Higuoxing created this revision.Sep 14 2020, 1:30 AM
Higuoxing requested review of this revision.Sep 14 2020, 1:30 AM
grimar added inline comments.Sep 14 2020, 3:23 AM
llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
187 ↗(On Diff #291510)

All these getters are short. I'd just implement them in the header file.

llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml
183

a->an

208

I wonder if instead we should just provide a section description with an arbitrary unsupported content.
E.g:

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

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.

llvm/tools/obj2yaml/dwarf2yaml.cpp
78

I think you can avoid having Entries and insert directly to SegAddrPairs?

80

You can avoid copying a vector with

Y.DebugAddr = std::move(AddrTables);
jhenderson added inline comments.Sep 14 2020, 3:44 AM
llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml
8

Any reason you have separate variables for the two address sizes? As far as I can see, they are identical always.

9

This is more robust against other data being emitted in the future causing failures, in my opinion.

10–14

I found the naming scheme of these variables a bit confusing, as I was trying to match up "12" with the value "14", when really you meant "length one-two". I'd just go with LENGTH1 and LENGTH2 etc, i.e. the number of times the value is reused is irrelevant to the naming in this contaxt, at least.

83

Nit: here and below.

184

I think this is a little cleaner English.

Higuoxing marked 11 inline comments as done.

Address review comments.

Thanks for reviewing!

llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml
8

Oh, sorry. I should use one address size here.

MaskRay added inline comments.Sep 14 2020, 11:13 PM
llvm/tools/obj2yaml/dwarf2yaml.cpp
60

Delete DiscardError

62

extractV5(..., consumeError)

64
Higuoxing marked 3 inline comments as done.

Address comments.

Thanks!

jhenderson accepted this revision.Sep 15 2020, 5:59 AM

LGTM, thanks!

llvm/tools/obj2yaml/dwarf2yaml.cpp
62

Nice suggestion!

This revision is now accepted and ready to land.Sep 15 2020, 5:59 AM