[PATCH] D73103: [DWARF] Support 64-bit DWARF in .debug_pubnames and alike.
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 23:54:44 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5a9ef6c15f37: [DWARF] Support 64-bit DWARF in .debug_pubnames and similar tables. (authored by ikudrin).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73103/new/
https://reviews.llvm.org/D73103
Files:
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames.s
Index: llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames.s
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames.s
@@ -0,0 +1,26 @@
+# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
+# RUN: llvm-dwarfdump -debug-pubnames - | \
+# RUN: FileCheck %s
+
+# CHECK: .debug_pubnames contents:
+# CHECK-NEXT: length = 0x00000032
+# CHECK-SAME: version = 0x0002
+# CHECK-SAME: unit_offset = 0x1122334455667788
+# CHECK-SAME: unit_size = 0x1100220033004400
+# CHECK-NEXT: Offset Name
+# CHECK-NEXT: 0xaa01aaaabbbbbbbb "foo"
+# CHECK-NEXT: 0xaa02aaaabbbbbbbb "bar"
+
+ .section .debug_pubnames,"", at progbits
+ .long 0xffffffff # DWARF64 mark
+ .quad .Lend - .Lversion # Unit Length
+.Lversion:
+ .short 2 # Version
+ .quad 0x1122334455667788 # Debug Info Offset
+ .quad 0x1100220033004400 # Debug Info Length
+ .quad 0xaa01aaaabbbbbbbb # Tuple0: Offset
+ .asciz "foo" # Name
+ .quad 0xaa02aaaabbbbbbbb # Tuple1: Offset
+ .asciz "bar" # Name
+ .quad 0 # Terminator
+.Lend:
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
@@ -28,13 +28,20 @@
Sets.push_back({});
Set &SetData = Sets.back();
+ dwarf::DwarfFormat Format = dwarf::DWARF32;
SetData.Length = PubNames.getU32(&Offset);
+ if (SetData.Length == dwarf::DW_LENGTH_DWARF64) {
+ Format = dwarf::DWARF64;
+ SetData.Length = PubNames.getU64(&Offset);
+ }
+ const unsigned OffsetSize = dwarf::getDwarfOffsetByteSize(Format);
+
SetData.Version = PubNames.getU16(&Offset);
- SetData.Offset = PubNames.getRelocatedValue(4, &Offset);
- SetData.Size = PubNames.getU32(&Offset);
+ SetData.Offset = PubNames.getRelocatedValue(OffsetSize, &Offset);
+ SetData.Size = PubNames.getUnsigned(&Offset, OffsetSize);
while (Offset < Sec.Data.size()) {
- uint32_t DieRef = PubNames.getU32(&Offset);
+ uint64_t DieRef = PubNames.getUnsigned(&Offset, OffsetSize);
if (DieRef == 0)
break;
uint8_t IndexEntryValue = GnuStyle ? PubNames.getU8(&Offset) : 0;
@@ -47,10 +54,10 @@
void DWARFDebugPubTable::dump(raw_ostream &OS) const {
for (const Set &S : Sets) {
- OS << "length = " << format("0x%08x", S.Length);
+ OS << "length = " << format("0x%08" PRIx64, S.Length);
OS << " version = " << format("0x%04x", S.Version);
OS << " unit_offset = " << format("0x%08" PRIx64, S.Offset);
- OS << " unit_size = " << format("0x%08x", S.Size) << '\n';
+ OS << " unit_size = " << format("0x%08" PRIx64, S.Size) << '\n';
OS << (GnuStyle ? "Offset Linkage Kind Name\n"
: "Offset Name\n");
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
@@ -42,7 +42,7 @@
struct Set {
/// The total length of the entries for that set, not including the length
/// field itself.
- uint32_t Length;
+ uint64_t Length;
/// This number is specific to the name lookup table and is independent of
/// the DWARF version number.
@@ -54,7 +54,7 @@
/// The size in bytes of the contents of the .debug_info section generated
/// to represent that compilation unit.
- uint32_t Size;
+ uint64_t Size;
std::vector<Entry> Entries;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73103.239786.patch
Type: text/x-patch
Size: 3761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200123/91bf6d7b/attachment.bin>
More information about the llvm-commits
mailing list