diff options
author | Spyridoula Gravani <sgravani@apple.com> | 2017-06-29 20:13:05 +0000 |
---|---|---|
committer | Spyridoula Gravani <sgravani@apple.com> | 2017-06-29 20:13:05 +0000 |
commit | 837c110cb114a105fa0fe186fbb1ba542cc07601 (patch) | |
tree | 08b9cbd593afd619f85bfa155c3fd67260aac9c8 /llvm/include | |
parent | 3f984ecb45d694727d1fb3522bf362e95028e231 (diff) | |
download | bcm5719-llvm-837c110cb114a105fa0fe186fbb1ba542cc07601.tar.gz bcm5719-llvm-837c110cb114a105fa0fe186fbb1ba542cc07601.zip |
[DWARF] Added verification checks for the .apple_names section.
This patch verifies the number of atoms, the validity of the form for each atom, as well as the validity of the
hashdata. For hashdata, we're verifying that the hashdata offset is correct and that the offset in the .debug_info for
each DIE in the hashdata is also valid.
llvm-svn: 306735
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/BinaryFormat/Dwarf.h | 3 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h index ab927565d05..80456a0808f 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.h +++ b/llvm/include/llvm/BinaryFormat/Dwarf.h @@ -62,6 +62,9 @@ enum LLVMConstants : uint32_t { const uint32_t DW_CIE_ID = UINT32_MAX; const uint64_t DW64_CIE_ID = UINT64_MAX; +// Identifier of an invalid DIE offset in the .debug_info section. +const uint32_t DW_INVALID_OFFSET = UINT32_MAX; + enum Tag : uint16_t { #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) DW_TAG_##NAME = ID, #include "llvm/BinaryFormat/Dwarf.def" diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h index c19690a325e..eb6d0f541c1 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h @@ -54,6 +54,18 @@ public: uint32_t getNumHashes(); uint32_t getSizeHdr(); uint32_t getHeaderDataLength(); + ArrayRef<std::pair<HeaderData::AtomType, HeaderData::Form>> getAtomsDesc(); + bool validateForms(); + + /// Return information related to the DWARF DIE we're looking for when + /// performing a lookup by name. + /// + /// \param HashDataOffset an offset into the hash data table + /// \returns DIEOffset the offset into the .debug_info section for the DIE + /// related to the input hash data offset. Currently this function returns + /// only the DIEOffset but it can be modified to return more data regarding + /// the DIE + uint32_t readAtoms(uint32_t &HashDataOffset); void dump(raw_ostream &OS) const; }; |