summaryrefslogtreecommitdiff
path: root/lib/DebugInfo
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2017-11-27 16:40:46 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2017-11-27 16:40:46 +0000
commit8856af92cab0c699e9f75abc231d170772b5362a (patch)
tree774b5eeb550d81a7fcfc13e32fa5c9c927d32d94 /lib/DebugInfo
parent52a381f749b4f9388f811ce1d359926dceefdeb2 (diff)
[llvm-dwarfdump] Display DW_AT_high_pc as absolute value
DWARF4 relative DW_AT_high_pc values are now displayed as absolute addresses. The relative value is only shown when explicitly dumping the forms, i.e. in show-form or verbose mode. ``` DW_AT_low_pc (0x0000000000000049) DW_AT_high_pc (0x00000019) ``` becomes ``` DW_AT_low_pc (0x0000000000000049) DW_AT_high_pc (0x0000000000000062) ``` Differential revision: https://reviews.llvm.org/D40317 rdar://35416943 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319044 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r--lib/DebugInfo/DWARF/DWARFDie.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/DebugInfo/DWARF/DWARFDie.cpp b/lib/DebugInfo/DWARF/DWARFDie.cpp
index a579c06d02e..6dd5ecb34e4 100644
--- a/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -234,9 +234,17 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
WithColor(OS, Color) << Name;
else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line)
OS << *formValue.getAsUnsignedConstant();
- else if (Attr == DW_AT_location || Attr == DW_AT_frame_base ||
- Attr == DW_AT_data_member_location ||
- Attr == DW_AT_GNU_call_site_value)
+ else if (Attr == DW_AT_high_pc && !DumpOpts.ShowForm && !DumpOpts.Verbose &&
+ formValue.getAsUnsignedConstant()) {
+ // Print the actual address rather than the offset.
+ uint64_t LowPC, HighPC, Index;
+ if (Die.getLowAndHighPC(LowPC, HighPC, Index))
+ OS << format("0x%016" PRIx64, HighPC);
+ else
+ formValue.dump(OS, DumpOpts);
+ } else if (Attr == DW_AT_location || Attr == DW_AT_frame_base ||
+ Attr == DW_AT_data_member_location ||
+ Attr == DW_AT_GNU_call_site_value)
dumpLocation(OS, formValue, U, sizeof(BaseIndent) + Indent + 4, DumpOpts);
else
formValue.dump(OS, DumpOpts);