[PATCH] D154638: Emit a .debug_addr section with dsymutil
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 13 11:51:01 PDT 2023
JDevlieghere added inline comments.
================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:1393-1405
Die.addValue(DIEAlloc, static_cast<dwarf::Attribute>(AttrSpec.Attr),
- AttrSpec.Form, DIEInteger(*Addr));
- return Unit.getOrigUnit().getAddressByteSize();
+ AttrSpec.Form, DIEInteger(AddrPool.getAddrIndex(*Addr)));
+
+ assert((AttrSpec.Form == dwarf::DW_FORM_addrx) ||
+ (AttrSpec.Form == dwarf::DW_FORM_addrx1 &&
+ AddrPool.getAddrIndex(*Addr) <= UINT8_MAX) ||
+ (AttrSpec.Form == dwarf::DW_FORM_addrx2 &&
----------------
Let's extract `AddrPool.getAddrIndex(*Addr)` and assign it to a variable that you can reuse in the assert. Also, is the assert actually checking internal consistency or catching invalid DWARF? If it's the latter we should emit an error/warning instead.
================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:2011
+
+ llvm_unreachable("Didn't find DW_AT_addr_base in cloned DIE!");
+}
----------------
Similar question as for the assert: is this checking internal consistency (i.e. that we have created a `DW_AT_addr_base` in the cloned DIE) or can this trip for invalid input?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154638/new/
https://reviews.llvm.org/D154638
More information about the llvm-commits
mailing list