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 "DWARFAbbreviationDeclaration.h" 19 #include "DWARFDefines.h" 20 21 typedef std::vector<DWARFAbbreviationDeclaration> 22 DWARFAbbreviationDeclarationColl; 23 typedef DWARFAbbreviationDeclarationColl::iterator 24 DWARFAbbreviationDeclarationCollIter; 25 typedef DWARFAbbreviationDeclarationColl::const_iterator 26 DWARFAbbreviationDeclarationCollConstIter; 27 28 class DWARFAbbreviationDeclarationSet { 29 public: DWARFAbbreviationDeclarationSet()30 DWARFAbbreviationDeclarationSet() 31 : m_offset(DW_INVALID_OFFSET), m_idx_offset(0), m_decls() {} 32 DWARFAbbreviationDeclarationSet(dw_offset_t offset,uint32_t idx_offset)33 DWARFAbbreviationDeclarationSet(dw_offset_t offset, uint32_t idx_offset) 34 : m_offset(offset), m_idx_offset(idx_offset), m_decls() {} 35 36 void Clear(); GetOffset()37 dw_offset_t GetOffset() const { return m_offset; } 38 void Dump(lldb_private::Stream *s) const; 39 bool Extract(const lldb_private::DWARFDataExtractor &data, 40 lldb::offset_t *offset_ptr); 41 // void Encode(BinaryStreamBuf& debug_abbrev_buf) const; 42 dw_uleb128_t 43 AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration &abbrevDecl); 44 void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const; 45 46 const DWARFAbbreviationDeclaration * 47 GetAbbreviationDeclaration(dw_uleb128_t abbrCode) const; 48 49 private: 50 dw_offset_t m_offset; 51 uint32_t m_idx_offset; 52 std::vector<DWARFAbbreviationDeclaration> m_decls; 53 }; 54 55 typedef std::map<dw_offset_t, DWARFAbbreviationDeclarationSet> 56 DWARFAbbreviationDeclarationCollMap; 57 typedef DWARFAbbreviationDeclarationCollMap::iterator 58 DWARFAbbreviationDeclarationCollMapIter; 59 typedef DWARFAbbreviationDeclarationCollMap::const_iterator 60 DWARFAbbreviationDeclarationCollMapConstIter; 61 62 class DWARFDebugAbbrev { 63 public: 64 DWARFDebugAbbrev(); 65 const DWARFAbbreviationDeclarationSet * 66 GetAbbreviationDeclarationSet(dw_offset_t cu_abbr_offset) const; 67 void Dump(lldb_private::Stream *s) const; 68 void Parse(const lldb_private::DWARFDataExtractor &data); 69 void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const; 70 71 protected: 72 DWARFAbbreviationDeclarationCollMap m_abbrevCollMap; 73 mutable DWARFAbbreviationDeclarationCollMapConstIter m_prev_abbr_offset_pos; 74 }; 75 76 #endif // SymbolFileDWARF_DWARFDebugAbbrev_h_ 77