summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibDebug/Dwarf/AbbreviationsMap.h
blob: f1a5459c73eee5a6b79609c585a1722b4dae6f6b (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
/*
 * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "DwarfTypes.h"
#include <AK/HashMap.h>
#include <AK/Optional.h>
#include <AK/Types.h>

namespace Debug::Dwarf {

class DwarfInfo;

class AbbreviationsMap {
public:
    AbbreviationsMap(DwarfInfo const& dwarf_info, u32 offset);

    struct AbbreviationEntry {

        EntryTag tag;
        bool has_children;

        Vector<AttributeSpecification> attribute_specifications;
    };

    Optional<AbbreviationEntry> get(u32 code) const;

private:
    void populate_map();

    DwarfInfo const& m_dwarf_info;
    u32 m_offset { 0 };
    HashMap<u32, AbbreviationEntry> m_entries;
};

}