Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / dwarf2 / abbrev.h
CommitLineData
3054dd54
TT
1/* DWARF abbrev table
2
88b9d363 3 Copyright (C) 1994-2022 Free Software Foundation, Inc.
3054dd54
TT
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
af0b2a3e
TT
30#include "hashtab.h"
31
3054dd54 32struct attr_abbrev
4444f407
TT
33{
34 ENUM_BITFIELD(dwarf_attribute) name : 16;
35 ENUM_BITFIELD(dwarf_form) form : 16;
3054dd54 36
4444f407
TT
37 /* It is valid only if FORM is DW_FORM_implicit_const. */
38 LONGEST implicit_const;
39};
40
41/* This data structure holds the information of an abbrev. */
42struct abbrev_info
43{
44 /* Number identifying abbrev. */
45 unsigned int number;
46 /* DWARF tag. */
47 enum dwarf_tag tag;
48 /* True if the DIE has children. */
49 unsigned short has_children;
50 /* Number of attributes. */
51 unsigned short num_attrs;
52 /* An array of attribute descriptions, allocated using the struct
53 hack. */
54 struct attr_abbrev attrs[1];
55};
3054dd54 56
86de1d91
TT
57struct abbrev_table;
58typedef std::unique_ptr<struct abbrev_table> abbrev_table_up;
59
3054dd54
TT
60/* Top level data structure to contain an abbreviation table. */
61
62struct abbrev_table
63{
606decb2
TT
64 /* Read an abbrev table from the indicated section, at the given
65 offset. The caller is responsible for ensuring that the section
66 has already been read. */
67
68 static abbrev_table_up read (struct dwarf2_section_info *section,
86de1d91
TT
69 sect_offset sect_off);
70
71 /* Look up an abbrev in the table.
72 Returns NULL if the abbrev is not found. */
73
7c32eebb 74 const struct abbrev_info *lookup_abbrev (unsigned int abbrev_number) const
af0b2a3e
TT
75 {
76 struct abbrev_info search;
77 search.number = abbrev_number;
86de1d91 78
af0b2a3e
TT
79 return (struct abbrev_info *) htab_find_with_hash (m_abbrevs.get (),
80 &search,
81 abbrev_number);
82 }
86de1d91
TT
83
84 /* Where the abbrev table came from.
85 This is used as a sanity check when the table is used. */
86 const sect_offset sect_off;
87
88private:
89
1d33d811 90 explicit abbrev_table (sect_offset off);
3054dd54
TT
91
92 DISABLE_COPY_AND_ASSIGN (abbrev_table);
93
3054dd54 94 /* Add an abbreviation to the table. */
af0b2a3e 95 void add_abbrev (struct abbrev_info *abbrev);
3054dd54 96
1d33d811
TT
97 /* Hash table of abbrevs. */
98 htab_up m_abbrevs;
3054dd54 99
86de1d91
TT
100 /* Storage for the abbrev table. */
101 auto_obstack m_abbrev_obstack;
102};
3054dd54
TT
103
104#endif /* GDB_DWARF2_ABBREV_H */
This page took 0.166225 seconds and 4 git commands to generate.