mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[DWARF] Support 64-bit DWARF in .debug_pubnames and similar tables.
Differential Revision: https://reviews.llvm.org/D73103
This commit is contained in:
parent
7114b2fa27
commit
a61b960e43
@ -42,7 +42,7 @@ public:
|
||||
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 @@ public:
|
||||
|
||||
/// 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;
|
||||
};
|
||||
|
@ -28,13 +28,20 @@ DWARFDebugPubTable::DWARFDebugPubTable(const DWARFObject &Obj,
|
||||
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 @@ DWARFDebugPubTable::DWARFDebugPubTable(const DWARFObject &Obj,
|
||||
|
||||
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");
|
||||
|
||||
|
26
test/DebugInfo/X86/dwarfdump-debug-pubnames.s
Normal file
26
test/DebugInfo/X86/dwarfdump-debug-pubnames.s
Normal file
@ -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,"",@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:
|
Loading…
Reference in New Issue
Block a user