[PATCH] D47152: [DebugInfo] Use absolute addresses in location lists
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 21 10:56:19 PDT 2018
dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.
================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDie.cpp:111-115
+ uint64_t BaseAddr = 0;
+ if (Optional<BaseAddress> BA = U->getBaseAddress())
+ BaseAddr = BA->Address;
+ LL->dump(OS, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, BaseAddr,
+ Indent);
----------------
Might be able to replace "BaseAddr" with "U->getBaseAddress().getValueOr(0)" ?
================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp:578-586
+ if (BaseAddr)
+ return BaseAddr;
+
+ DWARFDie UnitDie = getUnitDIE();
+ Optional<DWARFFormValue> PC = UnitDie.find({DW_AT_low_pc, DW_AT_entry_pc});
+ if (Optional<uint64_t> Addr = toAddress(PC))
+ BaseAddr = {*Addr, PC->getSectionIndex()};
----------------
This implementation has the unfortunate property of not caching the result when the result is negative/empty. Is that worth worrying about/fixing/addressing? Probably not, I guess. Not a really big cost, and not having a base address is a corner/uncomomn case. (debug info for modules - that only contain type information, and no code/addresses, would be one such situation where there's a CU with no base address)
Repository:
rL LLVM
https://reviews.llvm.org/D47152
More information about the llvm-commits
mailing list