DWARF: Fail gracefully when encountering unknown values in an abbrev.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139777 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2011-09-15 04:00:58 +00:00
parent 6bc4e712dc
commit 42180e8336

View File

@ -47,11 +47,16 @@ DWARFAbbreviationDeclaration::extract(DataExtractor data, uint32_t* offset_ptr,
}
void DWARFAbbreviationDeclaration::dump(raw_ostream &OS) const {
OS << '[' << getCode() << "] " << TagString(getTag()) << "\tDW_CHILDREN_"
const char *tagString = TagString(getTag());
OS << '[' << getCode() << "] " << (tagString ? tagString : "DW_TAG_Unknown")
<< "\tDW_CHILDREN_"
<< (hasChildren() ? "yes" : "no") << '\n';
for (unsigned i = 0, e = Attributes.size(); i != e; ++i)
OS << '\t' << AttributeString(Attributes[i].getAttribute())
<< '\t' << FormEncodingString(Attributes[i].getForm()) << '\n';
for (unsigned i = 0, e = Attributes.size(); i != e; ++i) {
const char *attrString = AttributeString(Attributes[i].getAttribute());
const char *formString = FormEncodingString(Attributes[i].getForm());
OS << '\t' << (attrString ? attrString : "DW_AT_Unknown")
<< '\t' << (formString ? formString : "DW_FORM_Unknown") << '\n';
}
OS << '\n';
}