1 /* DWARF abbrev table cache
3 Copyright (C) 2022 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef GDB_DWARF2_ABBREV_CACHE_H
21 #define GDB_DWARF2_ABBREV_CACHE_H
23 #include "dwarf2/abbrev.h"
26 /* An abbrev cache holds abbrev tables for easier reuse. */
31 DISABLE_COPY_AND_ASSIGN (abbrev_cache
);
33 /* Find an abbrev table coming from the abbrev section SECTION at
34 offset OFFSET. Return the table, or nullptr if it has not yet
36 abbrev_table
*find (struct dwarf2_section_info
*section
, sect_offset offset
)
38 search_key key
= { section
, offset
};
40 return (abbrev_table
*) htab_find_with_hash (m_tables
.get (), &key
,
41 to_underlying (offset
));
44 /* Add TABLE to this cache. Ownership of TABLE is transferred to
45 the cache. Note that a table at a given section+offset may only
46 be registered once -- a violation of this will cause an assert.
47 To avoid this, call the 'find' method first, to see if the table
48 has already been read. */
49 void add (abbrev_table_up table
);
53 static hashval_t
hash_table (const void *item
);
54 static int eq_table (const void *lhs
, const void *rhs
);
58 struct dwarf2_section_info
*section
;
62 /* Hash table of abbrev tables. */
66 #endif /* GDB_DWARF2_ABBREV_CACHE_H */