LLDB mainline
DWARFAbbreviationDeclaration.h
Go to the documentation of this file.
1//===-- DWARFAbbreviationDeclaration.h --------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFABBREVIATIONDECLARATION_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFABBREVIATIONDECLARATION_H
11
12#include "DWARFAttribute.h"
13#include "DWARFDefines.h"
14#include "SymbolFileDWARF.h"
15#include "llvm/Support/Error.h"
16
18public:
19 enum { InvalidCode = 0 };
21
22 // For hand crafting an abbreviation declaration
23 DWARFAbbreviationDeclaration(dw_tag_t tag, uint8_t has_children);
24
25 dw_uleb128_t Code() const { return m_code; }
26 void SetCode(dw_uleb128_t code) { m_code = code; }
27 dw_tag_t Tag() const { return m_tag; }
28 bool HasChildren() const { return m_has_children; }
29 size_t NumAttributes() const { return m_attributes.size(); }
31 return m_attributes.size() > idx ? m_attributes[idx].get_form() : 0;
32 }
33
34 // idx is assumed to be valid when calling GetAttrAndFormByIndex()
36 DWARFFormValue &form_value) const {
37 m_attributes[idx].get(attr, form_value.FormRef(), form_value.ValueRef());
38 }
40 return m_attributes[idx].get_form();
41 }
43
44 /// Extract one abbreviation declaration and all of its associated attributes.
45 /// Possible return values:
46 /// DWARFEnumState::Complete - the extraction completed successfully. This
47 /// was the last abbrev decl in a sequence, and the user should not call
48 /// this function again.
49 /// DWARFEnumState::MoreItems - the extraction completed successfully. The
50 /// user should call this function again to retrieve the next decl.
51 /// llvm::Error - A parsing error occurred. The debug info is malformed.
52 llvm::Expected<lldb_private::DWARFEnumState>
54 lldb::offset_t *offset_ptr);
55 bool IsValid();
56
57protected:
59 dw_tag_t m_tag = llvm::dwarf::DW_TAG_null;
60 uint8_t m_has_children = 0;
62};
63
64#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFABBREVIATIONDECLARATION_H
DWARFAttribute::collection m_attributes
void GetAttrAndFormValueByIndex(uint32_t idx, dw_attr_t &attr, DWARFFormValue &form_value) const
dw_form_t GetFormByIndex(uint32_t idx) const
dw_form_t GetFormByIndexUnchecked(uint32_t idx) const
uint32_t FindAttributeIndex(dw_attr_t attr) const
llvm::Expected< lldb_private::DWARFEnumState > extract(const lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr)
Extract one abbreviation declaration and all of its associated attributes.
std::vector< DWARFAttribute > collection
ValueType & ValueRef()
dw_form_t & FormRef()
llvm::dwarf::Tag dw_tag_t
Definition: dwarf.h:28
uint64_t offset_t
Definition: lldb-types.h:87