This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Use absolute addresses in location lists
ClosedPublic

Authored by JDevlieghere on May 21 2018, 10:29 AM.

Details

Summary

Rather than relying on the user to do the address calculating in
DW_AT_location we should just dump the absolute address.

rdar://problem/38513870

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.May 21 2018, 10:29 AM
dblaikie accepted this revision.May 21 2018, 10:56 AM
dblaikie added inline comments.
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
111–115

Might be able to replace "BaseAddr" with "U->getBaseAddress().getValueOr(0)" ?

llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
578–586

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)

This revision is now accepted and ready to land.May 21 2018, 10:56 AM
JDevlieghere marked 2 inline comments as done.May 21 2018, 11:04 AM
JDevlieghere added inline comments.
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
111–115

I think that wouldn't work here because the Optional wraps the struct rather than the unsigned?

dblaikie added inline comments.May 21 2018, 11:08 AM
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
111–115

Ah, sure enough. Could do "getValueOr(BaseAddress())" but that might be going further than is useful. Up to you.

aprantl accepted this revision.May 21 2018, 11:22 AM

Thanks, this was very confusing!

This revision was automatically updated to reflect the committed changes.
JDevlieghere marked an inline comment as done.

Thanks for the reviews, I'll keep it as is for now.