Commit | Line | Data |
---|---|---|
3054dd54 TT |
1 | /* DWARF abbrev table |
2 | ||
3 | Copyright (C) 1994-2020 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 | ||
af0b2a3e TT |
30 | #include "hashtab.h" |
31 | ||
3054dd54 TT |
32 | /* This data structure holds the information of an abbrev. */ |
33 | struct abbrev_info | |
34 | { | |
35 | unsigned int number; /* number identifying abbrev */ | |
36 | enum dwarf_tag tag; /* dwarf tag */ | |
37 | unsigned short has_children; /* boolean */ | |
38 | unsigned short num_attrs; /* number of attributes */ | |
39 | struct attr_abbrev *attrs; /* an array of attribute descriptions */ | |
3054dd54 TT |
40 | }; |
41 | ||
42 | struct attr_abbrev | |
43 | { | |
44 | ENUM_BITFIELD(dwarf_attribute) name : 16; | |
45 | ENUM_BITFIELD(dwarf_form) form : 16; | |
46 | ||
47 | /* It is valid only if FORM is DW_FORM_implicit_const. */ | |
48 | LONGEST implicit_const; | |
49 | }; | |
50 | ||
86de1d91 TT |
51 | struct abbrev_table; |
52 | typedef std::unique_ptr<struct abbrev_table> abbrev_table_up; | |
53 | ||
3054dd54 TT |
54 | /* Top level data structure to contain an abbreviation table. */ |
55 | ||
56 | struct abbrev_table | |
57 | { | |
86de1d91 TT |
58 | static abbrev_table_up read (struct objfile *objfile, |
59 | struct dwarf2_section_info *section, | |
60 | sect_offset sect_off); | |
61 | ||
62 | /* Look up an abbrev in the table. | |
63 | Returns NULL if the abbrev is not found. */ | |
64 | ||
af0b2a3e TT |
65 | struct abbrev_info *lookup_abbrev (unsigned int abbrev_number) |
66 | { | |
67 | struct abbrev_info search; | |
68 | search.number = abbrev_number; | |
86de1d91 | 69 | |
af0b2a3e TT |
70 | return (struct abbrev_info *) htab_find_with_hash (m_abbrevs.get (), |
71 | &search, | |
72 | abbrev_number); | |
73 | } | |
86de1d91 TT |
74 | |
75 | /* Where the abbrev table came from. | |
76 | This is used as a sanity check when the table is used. */ | |
77 | const sect_offset sect_off; | |
78 | ||
79 | private: | |
80 | ||
1d33d811 | 81 | explicit abbrev_table (sect_offset off); |
3054dd54 TT |
82 | |
83 | DISABLE_COPY_AND_ASSIGN (abbrev_table); | |
84 | ||
85 | /* Allocate space for a struct abbrev_info object in | |
86 | ABBREV_TABLE. */ | |
87 | struct abbrev_info *alloc_abbrev (); | |
88 | ||
89 | /* Add an abbreviation to the table. */ | |
af0b2a3e | 90 | void add_abbrev (struct abbrev_info *abbrev); |
3054dd54 | 91 | |
1d33d811 TT |
92 | /* Hash table of abbrevs. */ |
93 | htab_up m_abbrevs; | |
3054dd54 | 94 | |
86de1d91 TT |
95 | /* Storage for the abbrev table. */ |
96 | auto_obstack m_abbrev_obstack; | |
97 | }; | |
3054dd54 TT |
98 | |
99 | #endif /* GDB_DWARF2_ABBREV_H */ |