GDB (xrefs)
Loading...
Searching...
No Matches
abbrev.h
Go to the documentation of this file.
1/* DWARF abbrev table
2
3 Copyright (C) 1994-2023 Free Software Foundation, Inc.
4
5 Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
6 Inc. with support from Florida State University (under contract
7 with the Ada Joint Program Office), and Silicon Graphics, Inc.
8 Initial contribution by Brent Benson, Harris Computer Systems, Inc.,
9 based on Fred Fish's (Cygnus Support) implementation of DWARF 1
10 support.
11
12 This file is part of GDB.
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26
27#ifndef GDB_DWARF2_ABBREV_H
28#define GDB_DWARF2_ABBREV_H
29
30#include "hashtab.h"
31
33{
34 ENUM_BITFIELD(dwarf_attribute) name : 16;
35 ENUM_BITFIELD(dwarf_form) form : 16;
36
37 /* It is valid only if FORM is DW_FORM_implicit_const. */
39};
40
41/* This data structure holds the information of an abbrev. */
43{
44 /* Number identifying abbrev. */
45 unsigned int number;
46 /* DWARF tag. */
47 ENUM_BITFIELD (dwarf_tag) tag : 16;
48 /* True if the DIE has children. */
51 unsigned short size_if_constant;
52 unsigned short sibling_offset;
53 /* Number of attributes. */
54 unsigned short num_attrs;
55 /* An array of attribute descriptions, allocated using the struct
56 hack. */
57 struct attr_abbrev attrs[1];
58};
59
60struct abbrev_table;
61typedef std::unique_ptr<struct abbrev_table> abbrev_table_up;
62
63/* Top level data structure to contain an abbreviation table. */
64
66{
67 /* Read an abbrev table from the indicated section, at the given
68 offset. The caller is responsible for ensuring that the section
69 has already been read. */
70
72 sect_offset sect_off);
73
74 /* Look up an abbrev in the table.
75 Returns NULL if the abbrev is not found. */
76
77 const struct abbrev_info *lookup_abbrev (unsigned int abbrev_number) const
78 {
79 struct abbrev_info search;
80 search.number = abbrev_number;
81
82 return (struct abbrev_info *) htab_find_with_hash (m_abbrevs.get (),
83 &search,
84 abbrev_number);
85 }
86
87 /* Where the abbrev table came from.
88 This is used as a sanity check when the table is used. */
89 const sect_offset sect_off;
90
92
93private:
94
95 abbrev_table (sect_offset off, struct dwarf2_section_info *sect);
96
98
99 /* Add an abbreviation to the table. */
100 void add_abbrev (struct abbrev_info *abbrev);
101
102 /* Hash table of abbrevs. */
103 htab_up m_abbrevs;
104
105 /* Storage for the abbrev table. */
106 auto_obstack m_abbrev_obstack;
107};
108
109#endif /* GDB_DWARF2_ABBREV_H */
std::unique_ptr< struct abbrev_table > abbrev_table_up
Definition abbrev.h:61
__extension__ enum dwarf_tag tag
Definition abbrev.h:47
unsigned short num_attrs
Definition abbrev.h:54
struct attr_abbrev attrs[1]
Definition abbrev.h:57
unsigned int number
Definition abbrev.h:45
unsigned short sibling_offset
Definition abbrev.h:52
unsigned short size_if_constant
Definition abbrev.h:51
bool interesting
Definition abbrev.h:50
bool has_children
Definition abbrev.h:49
const sect_offset sect_off
Definition abbrev.h:89
void add_abbrev(struct abbrev_info *abbrev)
Definition abbrev.c:72
htab_up m_abbrevs
Definition abbrev.h:103
auto_obstack m_abbrev_obstack
Definition abbrev.h:106
static abbrev_table_up read(struct dwarf2_section_info *section, sect_offset sect_off)
Definition abbrev.c:120
const struct abbrev_info * lookup_abbrev(unsigned int abbrev_number) const
Definition abbrev.h:77
abbrev_table(sect_offset off, struct dwarf2_section_info *sect)
Definition abbrev.c:61
DISABLE_COPY_AND_ASSIGN(abbrev_table)
struct dwarf2_section_info * section
Definition abbrev.h:91
LONGEST implicit_const
Definition abbrev.h:38
__extension__ enum dwarf_attribute name
Definition abbrev.h:34
__extension__ enum dwarf_form form
Definition abbrev.h:35