1 //===-- DWARFDebugAbbrev.h --------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef SymbolFileDWARF_DWARFDebugAbbrev_h_
10 #define SymbolFileDWARF_DWARFDebugAbbrev_h_
15 #include "lldb/lldb-private.h"
17 #include "DWARFAbbreviationDeclaration.h"
18 #include "DWARFDefines.h"
20 typedef std::vector<DWARFAbbreviationDeclaration>
21 DWARFAbbreviationDeclarationColl;
22 typedef DWARFAbbreviationDeclarationColl::iterator
23 DWARFAbbreviationDeclarationCollIter;
24 typedef DWARFAbbreviationDeclarationColl::const_iterator
25 DWARFAbbreviationDeclarationCollConstIter;
27 class DWARFAbbreviationDeclarationSet {
29 DWARFAbbreviationDeclarationSet()
30 : m_offset(DW_INVALID_OFFSET), m_idx_offset(0), m_decls() {}
32 DWARFAbbreviationDeclarationSet(dw_offset_t offset, uint32_t idx_offset)
33 : m_offset(offset), m_idx_offset(idx_offset), m_decls() {}
36 dw_offset_t GetOffset() const { return m_offset; }
38 /// Extract all abbrev decls in a set. Returns llvm::ErrorSuccess() on
39 /// success, and an appropriate llvm::Error object otherwise.
40 llvm::Error extract(const lldb_private::DWARFDataExtractor &data,
41 lldb::offset_t *offset_ptr);
42 // void Encode(BinaryStreamBuf& debug_abbrev_buf) const;
43 void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const;
45 const DWARFAbbreviationDeclaration *
46 GetAbbreviationDeclaration(dw_uleb128_t abbrCode) const;
48 /// Unit test accessor functions.
50 uint32_t GetIndexOffset() const { return m_idx_offset; }
54 uint32_t m_idx_offset;
55 std::vector<DWARFAbbreviationDeclaration> m_decls;
58 typedef std::map<dw_offset_t, DWARFAbbreviationDeclarationSet>
59 DWARFAbbreviationDeclarationCollMap;
60 typedef DWARFAbbreviationDeclarationCollMap::iterator
61 DWARFAbbreviationDeclarationCollMapIter;
62 typedef DWARFAbbreviationDeclarationCollMap::const_iterator
63 DWARFAbbreviationDeclarationCollMapConstIter;
65 class DWARFDebugAbbrev {
68 const DWARFAbbreviationDeclarationSet *
69 GetAbbreviationDeclarationSet(dw_offset_t cu_abbr_offset) const;
70 /// Extract all abbreviations for a particular compile unit. Returns
71 /// llvm::ErrorSuccess() on success, and an appropriate llvm::Error object
73 llvm::Error parse(const lldb_private::DWARFDataExtractor &data);
74 void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const;
77 DWARFAbbreviationDeclarationCollMap m_abbrevCollMap;
78 mutable DWARFAbbreviationDeclarationCollMapConstIter m_prev_abbr_offset_pos;
81 #endif // SymbolFileDWARF_DWARFDebugAbbrev_h_