mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
llvm-dwarfdump: add support for .apple_types in --find
llvm-svn: 314479
This commit is contained in:
parent
ad66b459bd
commit
d2beca911e
@ -70,6 +70,7 @@ class DWARFContext : public DIContext {
|
|||||||
std::unique_ptr<DWARFDebugFrame> EHFrame;
|
std::unique_ptr<DWARFDebugFrame> EHFrame;
|
||||||
std::unique_ptr<DWARFDebugMacro> Macro;
|
std::unique_ptr<DWARFDebugMacro> Macro;
|
||||||
std::unique_ptr<DWARFAcceleratorTable> AppleNames;
|
std::unique_ptr<DWARFAcceleratorTable> AppleNames;
|
||||||
|
std::unique_ptr<DWARFAcceleratorTable> AppleTypes;
|
||||||
|
|
||||||
DWARFUnitSection<DWARFCompileUnit> DWOCUs;
|
DWARFUnitSection<DWARFCompileUnit> DWOCUs;
|
||||||
std::deque<DWARFUnitSection<DWARFTypeUnit>> DWOTUs;
|
std::deque<DWARFUnitSection<DWARFTypeUnit>> DWOTUs;
|
||||||
@ -242,6 +243,9 @@ public:
|
|||||||
/// Get a reference to the parsed accelerator table object.
|
/// Get a reference to the parsed accelerator table object.
|
||||||
const DWARFAcceleratorTable &getAppleNames();
|
const DWARFAcceleratorTable &getAppleNames();
|
||||||
|
|
||||||
|
/// Get a reference to the parsed accelerator table object.
|
||||||
|
const DWARFAcceleratorTable &getAppleTypes();
|
||||||
|
|
||||||
/// Get a pointer to a parsed line table corresponding to a compile unit.
|
/// Get a pointer to a parsed line table corresponding to a compile unit.
|
||||||
const DWARFDebugLine::LineTable *getLineTableForUnit(DWARFUnit *cu);
|
const DWARFDebugLine::LineTable *getLineTableForUnit(DWARFUnit *cu);
|
||||||
|
|
||||||
|
@ -457,8 +457,7 @@ void DWARFContext::dump(
|
|||||||
|
|
||||||
if (shouldDump(Explicit, ".apple_types", DIDT_ID_AppleTypes,
|
if (shouldDump(Explicit, ".apple_types", DIDT_ID_AppleTypes,
|
||||||
DObj->getAppleTypesSection().Data))
|
DObj->getAppleTypesSection().Data))
|
||||||
dumpAccelSection(OS, *DObj, DObj->getAppleTypesSection(),
|
getAppleTypes().dump(OS);
|
||||||
DObj->getStringSection(), isLittleEndian());
|
|
||||||
|
|
||||||
if (shouldDump(Explicit, ".apple_namespaces", DIDT_ID_AppleNamespaces,
|
if (shouldDump(Explicit, ".apple_namespaces", DIDT_ID_AppleNamespaces,
|
||||||
DObj->getAppleNamespacesSection().Data))
|
DObj->getAppleNamespacesSection().Data))
|
||||||
@ -655,6 +654,11 @@ const DWARFAcceleratorTable &DWARFContext::getAppleNames() {
|
|||||||
DObj->getStringSection(), isLittleEndian());
|
DObj->getStringSection(), isLittleEndian());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DWARFAcceleratorTable &DWARFContext::getAppleTypes() {
|
||||||
|
return getAccelTable(AppleTypes, *DObj, DObj->getAppleTypesSection(),
|
||||||
|
DObj->getStringSection(), isLittleEndian());
|
||||||
|
}
|
||||||
|
|
||||||
const DWARFLineTable *
|
const DWARFLineTable *
|
||||||
DWARFContext::getLineTableForUnit(DWARFUnit *U) {
|
DWARFContext::getLineTableForUnit(DWARFUnit *U) {
|
||||||
if (!Line)
|
if (!Line)
|
||||||
|
@ -26,3 +26,12 @@ MULTI: : DW_TAG_variable
|
|||||||
MULTI-NOT: {{: DW}}
|
MULTI-NOT: {{: DW}}
|
||||||
MULTI: DW_AT_name ("x86_64h_var")
|
MULTI: DW_AT_name ("x86_64h_var")
|
||||||
MULTI-NOT: {{: DW}}
|
MULTI-NOT: {{: DW}}
|
||||||
|
|
||||||
|
RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
|
||||||
|
RUN: | llvm-dwarfdump -find=int - | FileCheck %s --check-prefix=TYPES
|
||||||
|
TYPES: .debug_info contents:
|
||||||
|
TYPES-NOT: {{:}}
|
||||||
|
TYPES: : DW_TAG_base_type
|
||||||
|
TYPES-NOT: {{:}}
|
||||||
|
TYPES: DW_AT_name ("int")
|
||||||
|
TYPES-NOT: {{:}}
|
||||||
|
@ -247,11 +247,20 @@ static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename,
|
|||||||
// Handle the --find option and lower it to --debug-info=<offset>.
|
// Handle the --find option and lower it to --debug-info=<offset>.
|
||||||
if (!Find.empty()) {
|
if (!Find.empty()) {
|
||||||
DumpOffsets[DIDT_ID_DebugInfo] = [&]() -> llvm::Optional<uint64_t> {
|
DumpOffsets[DIDT_ID_DebugInfo] = [&]() -> llvm::Optional<uint64_t> {
|
||||||
for (auto Name : Find)
|
for (auto Name : Find) {
|
||||||
for (auto Entry : DICtx.getAppleNames().equal_range(Name))
|
auto find = [&](const DWARFAcceleratorTable &Accel)
|
||||||
for (auto Atom : Entry)
|
-> llvm::Optional<uint64_t> {
|
||||||
if (auto Offset = Atom.getAsSectionOffset())
|
for (auto Entry : Accel.equal_range(Name))
|
||||||
return DumpOffsets[DIDT_ID_DebugInfo] = *Offset;
|
for (auto Atom : Entry)
|
||||||
|
if (auto Offset = Atom.getAsSectionOffset())
|
||||||
|
return Offset;
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
if (auto Offset = find(DICtx.getAppleNames()))
|
||||||
|
return DumpOffsets[DIDT_ID_DebugInfo] = *Offset;
|
||||||
|
if (auto Offset = find(DICtx.getAppleTypes()))
|
||||||
|
return DumpOffsets[DIDT_ID_DebugInfo] = *Offset;
|
||||||
|
}
|
||||||
return None;
|
return None;
|
||||||
}();
|
}();
|
||||||
// Early exit if --find was specified but the current file doesn't have it.
|
// Early exit if --find was specified but the current file doesn't have it.
|
||||||
|
Loading…
Reference in New Issue
Block a user