diff options
author | Frederic Riss <friss@apple.com> | 2014-10-10 15:51:10 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2014-10-10 15:51:10 +0000 |
commit | b3c9912a4524db75721b6e164bdfc472d2784752 (patch) | |
tree | 24dcaf4aea32a01ebfae823a80502379800c3d82 /llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | |
parent | d4de180e19548b0de60126c8f63353aeeed5325a (diff) | |
download | bcm5719-llvm-b3c9912a4524db75721b6e164bdfc472d2784752.tar.gz bcm5719-llvm-b3c9912a4524db75721b6e164bdfc472d2784752.zip |
[dwarfdump] Prettyprint DW_AT_APPLE_property_attribute bitfield values.
This change depends on the ApplePropertyString helper that I sent spearately.
Not sure how you want this tested: as a tool test by adding a binary to dump, or as an llvm test starting from an IR file?
Reviewers: dblaikie, samsonov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5689
llvm-svn: 219507
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp index 559667299ca..15c04cb949b 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -12,6 +12,7 @@ #include "DWARFContext.h" #include "DWARFDebugAbbrev.h" #include "llvm/DebugInfo/DWARFFormValue.h" +#include "llvm/Support/DataTypes.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/Format.h" @@ -72,6 +73,21 @@ void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, DWARFUnit *u, } } +static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) { + OS << " ("; + do { + uint64_t Bit = 1ULL << countTrailingZeros(Val); + if (const char *PropName = ApplePropertyString(Bit)) + OS << PropName; + else + OS << format("DW_APPLE_PROPERTY_0x%" PRIx64, Bit); + if (!(Val ^= Bit)) + break; + OS << ", "; + } while (true); + OS << ")"; +} + void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, DWARFUnit *u, uint32_t *offset_ptr, @@ -130,6 +146,9 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, if (const DWARFUnit *RefU = findUnitAndExtractFast(DIE, u, &Ref)) if (const char *Ref = DIE.getName(RefU, DINameKind::LinkageName)) OS << " \"" << Ref << '\"'; + } else if (attr == DW_AT_APPLE_property_attribute) { + if (Optional<uint64_t> OptVal = formValue.getAsUnsignedConstant()) + dumpApplePropertyAttribute(OS, *OptVal); } OS << ")\n"; |