diff options
| author | Frederic Riss <friss@apple.com> | 2014-10-10 15:51:02 +0000 |
|---|---|---|
| committer | Frederic Riss <friss@apple.com> | 2014-10-10 15:51:02 +0000 |
| commit | d4de180e19548b0de60126c8f63353aeeed5325a (patch) | |
| tree | 977514fd7b583898a0738e4d3958572c02cd97c8 /llvm/lib | |
| parent | 2c99e413ba13284d119a5b3bc8085d066016dd3e (diff) | |
| download | bcm5719-llvm-d4de180e19548b0de60126c8f63353aeeed5325a.tar.gz bcm5719-llvm-d4de180e19548b0de60126c8f63353aeeed5325a.zip | |
[dwarfdump] Resolve also variable specifications/abstract_origins.
DW_AT_specification and DW_AT_abstract_origin resolving was only performed
on subroutine DIEs because it used the getSubroutineName method. Introduce
a more generic getName() and use it to dump the reference attributes.
Testcases have been updated to check the printed names instead of the offsets
except when the name could be ambiguous.
Reviewers: dblaikie, samsonov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5625
llvm-svn: 219506
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | 22 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugInfoEntry.h | 9 |
2 files changed, 20 insertions, 11 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp index 6d2e51a64dc..559667299ca 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -18,7 +18,6 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; using namespace dwarf; -typedef DILineInfoSpecifier::FunctionNameKind FunctionNameKind; // Small helper to extract a DIE pointed by a reference // attribute. It looks up the Unit containing the DIE and calls @@ -129,8 +128,7 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, uint32_t Ref = formValue.getAsReference(u).getValue(); DWARFDebugInfoEntryMinimal DIE; if (const DWARFUnit *RefU = findUnitAndExtractFast(DIE, u, &Ref)) - if (const char *Ref = DIE.getSubroutineName(RefU, - FunctionNameKind::LinkageName)) + if (const char *Ref = DIE.getName(RefU, DINameKind::LinkageName)) OS << " \"" << Ref << '\"'; } @@ -331,11 +329,19 @@ bool DWARFDebugInfoEntryMinimal::addressRangeContainsAddress( const char * DWARFDebugInfoEntryMinimal::getSubroutineName(const DWARFUnit *U, - FunctionNameKind Kind) const { - if (!isSubroutineDIE() || Kind == FunctionNameKind::None) + DINameKind Kind) const { + if (!isSubroutineDIE()) + return nullptr; + return getName(U, Kind); +} + +const char * +DWARFDebugInfoEntryMinimal::getName(const DWARFUnit *U, + DINameKind Kind) const { + if (Kind == DINameKind::None) return nullptr; // Try to get mangled name only if it was asked for. - if (Kind == FunctionNameKind::LinkageName) { + if (Kind == DINameKind::LinkageName) { if (const char *name = getAttributeValueAsString(U, DW_AT_MIPS_linkage_name, nullptr)) return name; @@ -351,7 +357,7 @@ DWARFDebugInfoEntryMinimal::getSubroutineName(const DWARFUnit *U, if (spec_ref != -1U) { DWARFDebugInfoEntryMinimal spec_die; if (const DWARFUnit *RefU = findUnitAndExtractFast(spec_die, U, &spec_ref)) { - if (const char *name = spec_die.getSubroutineName(RefU, Kind)) + if (const char *name = spec_die.getName(RefU, Kind)) return name; } } @@ -362,7 +368,7 @@ DWARFDebugInfoEntryMinimal::getSubroutineName(const DWARFUnit *U, DWARFDebugInfoEntryMinimal abs_origin_die; if (const DWARFUnit *RefU = findUnitAndExtractFast(abs_origin_die, U, &abs_origin_ref)) { - if (const char *name = abs_origin_die.getSubroutineName(RefU, Kind)) + if (const char *name = abs_origin_die.getName(RefU, Kind)) return name; } } diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h index 3f912e97b32..7e7efb98ba7 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h @@ -125,9 +125,12 @@ public: /// returns its mangled name (or short name, if mangled is missing). /// This name may be fetched from specification or abstract origin /// for this subprogram. Returns null if no name is found. - const char * - getSubroutineName(const DWARFUnit *U, - DILineInfoSpecifier::FunctionNameKind Kind) const; + const char *getSubroutineName(const DWARFUnit *U, DINameKind Kind) const; + + /// Return the DIE name resolving DW_AT_sepcification or + /// DW_AT_abstract_origin references if necessary. + /// Returns null if no name is found. + const char *getName(const DWARFUnit *U, DINameKind Kind) const; /// Retrieves values of DW_AT_call_file, DW_AT_call_line and /// DW_AT_call_column from DIE (or zeroes if they are missing). |

