1 //===-- DWARFDebugAbbrev.h --------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef SymbolFileDWARF_DWARFDebugAbbrev_h_ 11 #define SymbolFileDWARF_DWARFDebugAbbrev_h_ 12 13 #include <list> 14 #include <map> 15 16 #include "lldb/lldb-private.h" 17 18 #include "DWARFDefines.h" 19 #include "DWARFAbbreviationDeclaration.h" 20 21 typedef std::vector<DWARFAbbreviationDeclaration> DWARFAbbreviationDeclarationColl; 22 typedef DWARFAbbreviationDeclarationColl::iterator DWARFAbbreviationDeclarationCollIter; 23 typedef DWARFAbbreviationDeclarationColl::const_iterator DWARFAbbreviationDeclarationCollConstIter; 24 25 26 class DWARFAbbreviationDeclarationSet 27 { 28 public: DWARFAbbreviationDeclarationSet()29 DWARFAbbreviationDeclarationSet() : 30 m_offset(DW_INVALID_OFFSET), 31 m_idx_offset(0), 32 m_decls() 33 { 34 } 35 DWARFAbbreviationDeclarationSet(dw_offset_t offset,uint32_t idx_offset)36 DWARFAbbreviationDeclarationSet(dw_offset_t offset, uint32_t idx_offset) : 37 m_offset(offset), 38 m_idx_offset(idx_offset), 39 m_decls() 40 { 41 } 42 43 void Clear(); GetOffset()44 dw_offset_t GetOffset() const { return m_offset; } 45 void Dump(lldb_private::Stream *s) const; 46 bool Extract(const lldb_private::DataExtractor& data, lldb::offset_t *offset_ptr); 47 //void Encode(BinaryStreamBuf& debug_abbrev_buf) const; 48 dw_uleb128_t AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration& abbrevDecl); 49 50 const DWARFAbbreviationDeclaration* GetAbbreviationDeclaration(dw_uleb128_t abbrCode) const; 51 private: 52 dw_offset_t m_offset; 53 uint32_t m_idx_offset; 54 std::vector<DWARFAbbreviationDeclaration> m_decls; 55 }; 56 57 typedef std::map<dw_offset_t, DWARFAbbreviationDeclarationSet> DWARFAbbreviationDeclarationCollMap; 58 typedef DWARFAbbreviationDeclarationCollMap::iterator DWARFAbbreviationDeclarationCollMapIter; 59 typedef DWARFAbbreviationDeclarationCollMap::const_iterator DWARFAbbreviationDeclarationCollMapConstIter; 60 61 62 class DWARFDebugAbbrev 63 { 64 public: 65 DWARFDebugAbbrev(); 66 const DWARFAbbreviationDeclarationSet* GetAbbreviationDeclarationSet(dw_offset_t cu_abbr_offset) const; 67 void Dump(lldb_private::Stream *s) const; 68 void Parse(const lldb_private::DataExtractor& data); 69 protected: 70 DWARFAbbreviationDeclarationCollMap m_abbrevCollMap; 71 mutable DWARFAbbreviationDeclarationCollMapConstIter m_prev_abbr_offset_pos; 72 }; 73 74 #endif // SymbolFileDWARF_DWARFDebugAbbrev_h_ 75