diff options
author | Spyridoula Gravani <sgravani@apple.com> | 2017-07-31 18:01:16 +0000 |
---|---|---|
committer | Spyridoula Gravani <sgravani@apple.com> | 2017-07-31 18:01:16 +0000 |
commit | 70d35e102ef8dbba10e2db84ea2dcbe95bbbfd38 (patch) | |
tree | 690bb0dee93523750ca98e553d0957746d277098 /llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp | |
parent | 91c6330c96aaf14605f7d520af72c62c1284ae45 (diff) | |
download | bcm5719-llvm-70d35e102ef8dbba10e2db84ea2dcbe95bbbfd38.tar.gz bcm5719-llvm-70d35e102ef8dbba10e2db84ea2dcbe95bbbfd38.zip |
[DWARF] Added verification check for tags in accelerator tables. This patch verifies that the atom tag is actually the same with the tag of the DIE that we retrieve from the table.
Differential Revision: https://reviews.llvm.org/D35963
llvm-svn: 309596
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp index 9ae7c9a07f7..f17b00e5605 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp @@ -73,6 +73,8 @@ bool DWARFAcceleratorTable::validateForms() { DWARFFormValue FormValue(Atom.second); switch (Atom.first) { case dwarf::DW_ATOM_die_offset: + case dwarf::DW_ATOM_die_tag: + case dwarf::DW_ATOM_type_flags: if ((!FormValue.isFormClass(DWARFFormValue::FC_Constant) && !FormValue.isFormClass(DWARFFormValue::FC_Flag)) || FormValue.getForm() == dwarf::DW_FORM_sdata) @@ -84,8 +86,10 @@ bool DWARFAcceleratorTable::validateForms() { return true; } -uint32_t DWARFAcceleratorTable::readAtoms(uint32_t &HashDataOffset) { +std::pair<uint32_t, dwarf::Tag> +DWARFAcceleratorTable::readAtoms(uint32_t &HashDataOffset) { uint32_t DieOffset = dwarf::DW_INVALID_OFFSET; + dwarf::Tag DieTag = dwarf::DW_TAG_null; for (auto Atom : getAtomsDesc()) { DWARFFormValue FormValue(Atom.second); @@ -94,11 +98,14 @@ uint32_t DWARFAcceleratorTable::readAtoms(uint32_t &HashDataOffset) { case dwarf::DW_ATOM_die_offset: DieOffset = *FormValue.getAsUnsignedConstant(); break; + case dwarf::DW_ATOM_die_tag: + DieTag = (dwarf::Tag)*FormValue.getAsUnsignedConstant(); + break; default: break; } } - return DieOffset; + return {DieOffset, DieTag}; } LLVM_DUMP_METHOD void DWARFAcceleratorTable::dump(raw_ostream &OS) const { |