diff options
Diffstat (limited to 'gdb/dwarf2/abbrev.c')
-rw-r--r-- | gdb/dwarf2/abbrev.c | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c index 359a009..5cfff69 100644 --- a/gdb/dwarf2/abbrev.c +++ b/gdb/dwarf2/abbrev.c @@ -1,6 +1,6 @@ /* DWARF 2 abbreviations - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology, Inc. with support from Florida State University (under contract @@ -24,57 +24,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "dwarf2/read.h" #include "dwarf2/abbrev.h" #include "dwarf2/leb.h" +#include "dwarf2/section.h" #include "bfd.h" -/* Hash function for an abbrev. */ - -static hashval_t -hash_abbrev (const void *item) -{ - const struct abbrev_info *info = (const struct abbrev_info *) item; - /* Warning: if you change this next line, you must also update the - other code in this class using the _with_hash functions. */ - return info->number; -} - -/* Comparison function for abbrevs. */ - -static int -eq_abbrev (const void *lhs, const void *rhs) -{ - const struct abbrev_info *l_info = (const struct abbrev_info *) lhs; - const struct abbrev_info *r_info = (const struct abbrev_info *) rhs; - return l_info->number == r_info->number; -} - -/* Abbreviation tables. - - In DWARF version 2, the description of the debugging information is - stored in a separate .debug_abbrev section. Before we read any - dies from a section we read in all abbreviations and install them - in a hash table. */ - -abbrev_table::abbrev_table (sect_offset off, struct dwarf2_section_info *sect) - : sect_off (off), - section (sect), - m_abbrevs (htab_create_alloc (20, hash_abbrev, eq_abbrev, - nullptr, xcalloc, xfree)) -{ -} - -/* Add an abbreviation to the table. */ - -void -abbrev_table::add_abbrev (struct abbrev_info *abbrev) -{ - void **slot = htab_find_slot_with_hash (m_abbrevs.get (), abbrev, - abbrev->number, INSERT); - *slot = abbrev; -} - /* Helper function that returns true if a DIE with the given tag might plausibly be indexed. */ @@ -276,7 +230,8 @@ abbrev_table::read (struct dwarf2_section_info *section, } else if ((cur_abbrev->tag == DW_TAG_structure_type || cur_abbrev->tag == DW_TAG_class_type - || cur_abbrev->tag == DW_TAG_union_type) + || cur_abbrev->tag == DW_TAG_union_type + || cur_abbrev->tag == DW_TAG_namespace) && cur_abbrev->has_children) { /* We have to record this as interesting, regardless of how |