From 955724e3f5f3e8c5dc68a4594682839c811b63b4 Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Mon, 22 Sep 2014 12:36:04 +0000 Subject: [dwarfdump] Dump full filenames as DW_AT_(decl|call)_file attribute values Reviewers: dblaikie samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5192 llvm-svn: 218246 --- llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | 16 +++++++++++++--- llvm/lib/DebugInfo/DWARFDebugInfoEntry.h | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'llvm/lib/DebugInfo') diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp index 192cd3cdacf..81a976e4da1 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -31,7 +31,7 @@ static const DWARFUnit *findUnitAndExtractFast(DWARFDebugInfoEntryMinimal &DIE, return (Unit && DIE.extractFast(Unit, Offset)) ? Unit : nullptr; } -void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, const DWARFUnit *u, +void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, DWARFUnit *u, unsigned recurseDepth, unsigned indent) const { DataExtractor debug_info_data = u->getDebugInfoExtractor(); @@ -74,7 +74,7 @@ void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, const DWARFUnit *u, } void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, - const DWARFUnit *u, + DWARFUnit *u, uint32_t *offset_ptr, uint16_t attr, uint16_t form, unsigned indent) const { @@ -99,7 +99,17 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, OS << "\t("; const char *Name = nullptr; - if (Optional Val = formValue.getAsUnsignedConstant()) + std::string File; + if (attr == DW_AT_decl_file || attr == DW_AT_call_file) { + if (const auto *LT = u->getContext().getLineTableForUnit(u)) + if (LT->getFileNameByIndex( + formValue.getAsUnsignedConstant().getValue(), + u->getCompilationDir(), + DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, File)) { + File = '"' + File + '"'; + Name = File.c_str(); + } + } else if (Optional Val = formValue.getAsUnsignedConstant()) Name = AttributeValueString(attr, *Val); if (Name) { diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h index 336b1da0ed4..3f912e97b32 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h @@ -38,9 +38,9 @@ public: DWARFDebugInfoEntryMinimal() : Offset(0), SiblingIdx(0), AbbrevDecl(nullptr) {} - void dump(raw_ostream &OS, const DWARFUnit *u, unsigned recurseDepth, + void dump(raw_ostream &OS, DWARFUnit *u, unsigned recurseDepth, unsigned indent = 0) const; - void dumpAttribute(raw_ostream &OS, const DWARFUnit *u, uint32_t *offset_ptr, + void dumpAttribute(raw_ostream &OS, DWARFUnit *u, uint32_t *offset_ptr, uint16_t attr, uint16_t form, unsigned indent = 0) const; /// Extracts a debug info entry, which is a child of a given unit, -- cgit v1.2.3