/// for attribute Attr.
StringRef AttributeValueString(uint16_t Attr, unsigned Val);
+/// Returns the symbolic string representing Val when used as a value
+/// for atom Atom.
+StringRef AtomValueString(uint16_t Atom, unsigned Val);
+
/// Describes an entry of the various gnu_pub* debug sections.
///
/// The gnu_pub* kind looks like:
ListScope DataScope(W, ("Data " + Twine(Data)).str());
unsigned i = 0;
for (auto &Atom : AtomForms) {
- W.startLine() << format("Atom[%d]: ", i++);
- if (Atom.extractValue(AccelSection, DataOffset, FormParams))
+ W.startLine() << format("Atom[%d]: ", i);
+ if (Atom.extractValue(AccelSection, DataOffset, FormParams)) {
Atom.dump(W.getOStream());
- else
+ if (Optional<uint64_t> Val = Atom.getAsUnsignedConstant()) {
+ StringRef Str = dwarf::AtomValueString(HdrData.Atoms[i].first, *Val);
+ if (!Str.empty())
+ W.getOStream() << " (" << Str << ")";
+ }
+ } else
W.getOStream() << "Error extracting the value";
W.getOStream() << "\n";
+ i++;
}
}
return true; // more entries follow
CHECK: String: 0x00000066 "A"
CHECK-NEXT: Data 0 [
CHECK-NEXT: Atom[0]: 0x0000012d
-CHECK-NEXT: Atom[1]: 0x0013
+CHECK-NEXT: Atom[1]: 0x0013 (DW_TAG_structure_type)
CHECK-NEXT: Atom[2]: 0x02
CHECK-NEXT: Atom[3]: 0x0b87b15a
CHECK-NEXT: ]