blob: 5ee98c6a293f84a54285af3f255c596b3d0795ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* Copyright (c) 2020-2021, Itamar S. <itamar8910@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "AttributeValue.h"
#include "DwarfTypes.h"
#include <AK/Function.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/Optional.h>
#include <AK/Types.h>
namespace Debug::Dwarf {
class CompilationUnit;
// DIE = Debugging Information Entry
class DIE {
public:
DIE(const CompilationUnit&, u32 offset, Optional<u32> parent_offset = {});
u32 offset() const { return m_offset; }
u32 size() const { return m_size; }
bool has_children() const { return m_has_children; }
EntryTag tag() const { return m_tag; }
Optional<AttributeValue> get_attribute(const Attribute&) const;
void for_each_child(Function<void(const DIE& child)> callback) const;
bool is_null() const { return m_tag == EntryTag::None; }
const CompilationUnit& compilation_unit() const { return m_compilation_unit; }
Optional<u32> parent_offset() const { return m_parent_offset; }
private:
const CompilationUnit& m_compilation_unit;
u32 m_offset { 0 };
u32 m_data_offset { 0 };
size_t m_abbreviation_code { 0 };
EntryTag m_tag { EntryTag::None };
bool m_has_children { false };
u32 m_size { 0 };
Optional<u32> m_parent_offset;
};
}
|