mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-06 11:19:09 +00:00
DebugInfo: llvm-dwarfdump support for gnu_pubnames section
llvm-svn: 191050
This commit is contained in:
parent
64a3fccd60
commit
f60a2aeec3
@ -109,6 +109,7 @@ enum DIDumpType {
|
||||
DIDT_Loc,
|
||||
DIDT_Ranges,
|
||||
DIDT_Pubnames,
|
||||
DIDT_GnuPubnames,
|
||||
DIDT_Str,
|
||||
DIDT_StrDwo,
|
||||
DIDT_StrOffsetsDwo
|
||||
|
@ -821,19 +821,18 @@ StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
|
||||
/// offset of the cu within the debug_info section stored in those 24 bits.
|
||||
struct PubIndexEntryDescriptor {
|
||||
GDBIndexEntryKind Kind;
|
||||
GDBIndexEntryLinkage Static;
|
||||
PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Static)
|
||||
: Kind(Kind), Static(Static) {}
|
||||
GDBIndexEntryLinkage Linkage;
|
||||
PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
|
||||
: Kind(Kind), Linkage(Linkage) {}
|
||||
/* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
|
||||
: Kind(Kind), Static(GIEL_EXTERNAL) {}
|
||||
: Kind(Kind), Linkage(GIEL_EXTERNAL) {}
|
||||
explicit PubIndexEntryDescriptor(uint8_t Value)
|
||||
: Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
|
||||
KIND_OFFSET)),
|
||||
Static(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
|
||||
LINKAGE_OFFSET)) {}
|
||||
uint8_t toBits() {
|
||||
return Kind << KIND_OFFSET | Static << LINKAGE_OFFSET;
|
||||
}
|
||||
Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
|
||||
LINKAGE_OFFSET)) {}
|
||||
uint8_t toBits() { return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET; }
|
||||
|
||||
private:
|
||||
enum {
|
||||
KIND_OFFSET = 4,
|
||||
|
@ -2404,7 +2404,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
|
||||
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
|
||||
Asm->OutStreamer.AddComment(
|
||||
"Kind: " + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
||||
dwarf::GDBIndexEntryLinkageString(Desc.Static));
|
||||
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
||||
Asm->EmitInt8(Desc.toBits());
|
||||
}
|
||||
|
||||
@ -2466,7 +2466,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
|
||||
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
|
||||
Asm->OutStreamer.AddComment(
|
||||
"Kind: " + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
||||
dwarf::GDBIndexEntryLinkageString(Desc.Static));
|
||||
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
||||
Asm->EmitInt8(Desc.toBits());
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,27 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
|
||||
}
|
||||
}
|
||||
|
||||
if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames) {
|
||||
OS << "\n.debug_gnu_pubnames contents:\n";
|
||||
DataExtractor pubNames(getGnuPubNamesSection(), isLittleEndian(), 0);
|
||||
offset = 0;
|
||||
OS << "Length: " << pubNames.getU32(&offset) << "\n";
|
||||
OS << "Version: " << pubNames.getU16(&offset) << "\n";
|
||||
OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n";
|
||||
OS << "Size: " << pubNames.getU32(&offset) << "\n";
|
||||
OS << "Offset Linkage Kind Name\n";
|
||||
while (offset < getGnuPubNamesSection().size()) {
|
||||
uint32_t dieRef = pubNames.getU32(&offset);
|
||||
if (dieRef == 0)
|
||||
break;
|
||||
PubIndexEntryDescriptor desc(pubNames.getU8(&offset));
|
||||
OS << format("0x%8.8x ", dieRef)
|
||||
<< format("%-8s", dwarf::GDBIndexEntryLinkageString(desc.Linkage))
|
||||
<< ' ' << dwarf::GDBIndexEntryKindString(desc.Kind) << ' '
|
||||
<< pubNames.getCStr(&offset) << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) {
|
||||
const DWARFDebugAbbrev *D = getDebugAbbrevDWO();
|
||||
if (D) {
|
||||
@ -566,6 +587,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) :
|
||||
.Case("debug_str", &StringSection)
|
||||
.Case("debug_ranges", &RangeSection)
|
||||
.Case("debug_pubnames", &PubNamesSection)
|
||||
.Case("debug_gnu_pubnames", &GnuPubNamesSection)
|
||||
.Case("debug_info.dwo", &InfoDWOSection)
|
||||
.Case("debug_abbrev.dwo", &AbbrevDWOSection)
|
||||
.Case("debug_str.dwo", &StringDWOSection)
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
virtual StringRef getStringSection() = 0;
|
||||
virtual StringRef getRangeSection() = 0;
|
||||
virtual StringRef getPubNamesSection() = 0;
|
||||
virtual StringRef getGnuPubNamesSection() = 0;
|
||||
|
||||
// Sections for DWARF5 split dwarf proposal.
|
||||
virtual StringRef getInfoDWOSection() = 0;
|
||||
@ -166,6 +167,7 @@ class DWARFContextInMemory : public DWARFContext {
|
||||
StringRef StringSection;
|
||||
StringRef RangeSection;
|
||||
StringRef PubNamesSection;
|
||||
StringRef GnuPubNamesSection;
|
||||
|
||||
// Sections for DWARF5 split dwarf proposal.
|
||||
RelocAddrMap InfoDWORelocMap;
|
||||
@ -195,6 +197,7 @@ public:
|
||||
virtual StringRef getStringSection() { return StringSection; }
|
||||
virtual StringRef getRangeSection() { return RangeSection; }
|
||||
virtual StringRef getPubNamesSection() { return PubNamesSection; }
|
||||
virtual StringRef getGnuPubNamesSection() { return GnuPubNamesSection; }
|
||||
|
||||
// Sections for DWARF5 split dwarf proposal.
|
||||
virtual StringRef getInfoDWOSection() { return InfoDWOSection; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections -o - %s | FileCheck %s
|
||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections < %s | FileCheck -check-prefix=ASM %s
|
||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
|
||||
; ModuleID = 'dwarf-public-names.cpp'
|
||||
;
|
||||
; Generated from:
|
||||
@ -33,18 +34,20 @@
|
||||
; }
|
||||
|
||||
|
||||
; CHECK: .byte 32 # Kind: VARIABLE, EXTERNAL
|
||||
; CHECK-NEXT: .asciz "global_namespace_variable" # External Name
|
||||
; CHECK: .byte 48 # Kind: FUNCTION, EXTERNAL
|
||||
; CHECK-NEXT: .asciz "global_namespace_function" # External Name
|
||||
; CHECK: .byte 176 # Kind: FUNCTION, STATIC
|
||||
; CHECK-NEXT: .asciz "static_member_function" # External Name
|
||||
; CHECK: .byte 32 # Kind: VARIABLE, EXTERNAL
|
||||
; CHECK-NEXT: .asciz "global_variable" # External Name
|
||||
; CHECK: .byte 48 # Kind: FUNCTION, EXTERNAL
|
||||
; CHECK-NEXT: .asciz "global_function" # External Name
|
||||
; CHECK: .byte 176 # Kind: FUNCTION, STATIC
|
||||
; CHECK-NEXT: .asciz "member_function" # External Name
|
||||
; ASM: .byte 32 # Kind: VARIABLE, EXTERNAL
|
||||
|
||||
; CHECK: .debug_gnu_pubnames contents:
|
||||
; CHECK-NEXT: Length: 167
|
||||
; CHECK-NEXT: Version: 2
|
||||
; CHECK-NEXT: Offset in .debug_info: 0
|
||||
; CHECK-NEXT: Size: 317
|
||||
; CHECK-NEXT: Offset Linkage Kind Name
|
||||
; CHECK-DAG: 0x00000094 EXTERNAL VARIABLE global_namespace_variable
|
||||
; CHECK-DAG: 0x000000a3 EXTERNAL FUNCTION global_namespace_function
|
||||
; CHECK-DAG: 0x000000e8 STATIC FUNCTION static_member_function
|
||||
; CHECK-DAG: 0x0000007c EXTERNAL VARIABLE global_variable
|
||||
; CHECK-DAG: 0x000000ff EXTERNAL FUNCTION global_function
|
||||
; CHECK-DAG: 0x000000be STATIC FUNCTION member_function
|
||||
|
||||
%struct.C = type { i8 }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user