From: Tom Tromey Date: Sat, 16 Apr 2022 16:19:41 +0000 (-0600) Subject: Remove psymtab_addrmap X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32681b482a3a38e240100ddd00280a3db5716874;p=binutils-gdb.git Remove psymtab_addrmap While working on addrmaps, I noticed that psymtab_addrmap is no longer needed now. It was introduced in ancient times as an optimization for DWARF, but no other symbol reader was ever updated to use it. Now that DWARF does not use psymtabs, it can be deleted. --- diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index d3e6db4c109..64cb8d421b9 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2257,7 +2257,7 @@ create_signatured_type_table_from_debug_names } /* Read the address map data from the mapped index, and use it to - populate the psymtabs_addrmap. */ + populate the index_addrmap. */ static void create_addrmap_from_index (dwarf2_per_objfile *per_objfile, @@ -2485,7 +2485,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, } /* Read the address map data from DWARF-5 .debug_aranges, and use it to - populate the psymtabs_addrmap. */ + populate the index_addrmap. */ static void create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, diff --git a/gdb/psympriv.h b/gdb/psympriv.h index a7ba82a7604..61fb5c0f6c1 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -277,11 +277,11 @@ struct partial_symtab const char *dirname = nullptr; /* Range of text addresses covered by this file; texthigh is the - beginning of the next section. Do not use if PSYMTABS_ADDRMAP_SUPPORTED - is set. Do not refer directly to these fields. Instead, use the - accessors. The validity of these fields is determined by the - text_low_valid and text_high_valid fields; these are located later - in this structure for better packing. */ + beginning of the next section. Do not refer directly to these + fields. Instead, use the accessors. The validity of these + fields is determined by the text_low_valid and text_high_valid + fields; these are located later in this structure for better + packing. */ CORE_ADDR m_text_low = 0; CORE_ADDR m_text_high = 0; @@ -343,12 +343,6 @@ struct partial_symtab std::vector static_psymbols; - /* True iff objfile->psymtabs_addrmap is properly populated for this - partial_symtab. For discontiguous overlapping psymtabs is the only usable - info in PSYMTABS_ADDRMAP. */ - - bool psymtabs_addrmap_supported = false; - /* True if the name of this partial symtab is not a source file name. */ bool anonymous = false; diff --git a/gdb/psymtab.c b/gdb/psymtab.c index bf8a7432186..d16c3bb3083 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -98,8 +98,6 @@ find_pc_sect_psymtab_closer (struct objfile *objfile, struct partial_symtab *best_pst = pst; CORE_ADDR best_addr = pst->text_low (objfile); - gdb_assert (!pst->psymtabs_addrmap_supported); - /* An objfile that has its functions reordered might have many partial symbol tables containing the PC, but we want the partial symbol table that contains the @@ -171,70 +169,8 @@ psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile, struct obj_section *section, struct bound_minimal_symbol msymbol) { - /* Try just the PSYMTABS_ADDRMAP mapping first as it has better - granularity than the later used TEXTLOW/TEXTHIGH one. However, we need - to take care as the PSYMTABS_ADDRMAP can hold things other than partial - symtabs in some cases. - - This function should only be called for objfiles that are using partial - symtabs, not for objfiles that are using indexes (.gdb_index or - .debug_names), however 'maintenance print psymbols' calls this function - directly for all objfiles. If we assume that PSYMTABS_ADDRMAP contains - partial symtabs then we will end up returning a pointer to an object - that is not a partial_symtab, which doesn't end well. */ - - if (m_partial_symtabs->psymtabs != NULL - && m_partial_symtabs->psymtabs_addrmap != NULL) - { - CORE_ADDR baseaddr = objfile->text_section_offset (); - - struct partial_symtab *pst - = ((struct partial_symtab *) - m_partial_symtabs->psymtabs_addrmap->find (pc - baseaddr)); - if (pst != NULL) - { - /* FIXME: addrmaps currently do not handle overlayed sections, - so fall back to the non-addrmap case if we're debugging - overlays and the addrmap returned the wrong section. */ - if (overlay_debugging && msymbol.minsym != NULL && section != NULL) - { - struct partial_symbol *p; - - /* NOTE: This assumes that every psymbol has a - corresponding msymbol, which is not necessarily - true; the debug info might be much richer than the - object's symbol table. */ - p = find_pc_sect_psymbol (objfile, pst, pc, section); - if (p == NULL - || (p->address (objfile) - != msymbol.value_address ())) - goto next; - } - - /* We do not try to call FIND_PC_SECT_PSYMTAB_CLOSER as - PSYMTABS_ADDRMAP we used has already the best 1-byte - granularity and FIND_PC_SECT_PSYMTAB_CLOSER may mislead us into - a worse chosen section due to the TEXTLOW/TEXTHIGH ranges - overlap. */ - - return pst; - } - } - - next: - - /* Existing PSYMTABS_ADDRMAP mapping is present even for PARTIAL_SYMTABs - which still have no corresponding full SYMTABs read. But it is not - present for non-DWARF2 debug infos not supporting PSYMTABS_ADDRMAP in GDB - so far. */ - - /* Check even OBJFILE with non-zero PSYMTABS_ADDRMAP as only several of - its CUs may be missing in PSYMTABS_ADDRMAP as they may be varying - debug info type in single OBJFILE. */ - for (partial_symtab *pst : partial_symbols (objfile)) - if (!pst->psymtabs_addrmap_supported - && pc >= pst->text_low (objfile) && pc < pst->text_high (objfile)) + if (pc >= pst->text_low (objfile) && pc < pst->text_high (objfile)) { struct partial_symtab *best_pst; @@ -780,8 +716,6 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, gdb_printf (outfile, "-"); gdb_puts (paddress (gdbarch, psymtab->text_high (objfile)), outfile); gdb_printf (outfile, "\n"); - gdb_printf (outfile, " Address map supported - %s.\n", - psymtab->psymtabs_addrmap_supported ? "yes" : "no"); gdb_printf (outfile, " Depends on %d other partial symtabs.\n", psymtab->number_of_dependencies); for (i = 0; i < psymtab->number_of_dependencies; i++) @@ -1450,27 +1384,6 @@ psymtab_storage::discard_psymtab (struct partial_symtab *pst) -/* Helper function for maintenance_print_psymbols to print the addrmap - of PSYMTAB. If PSYMTAB is NULL print the entire addrmap. */ - -static void -dump_psymtab_addrmap (struct objfile *objfile, - psymtab_storage *partial_symtabs, - struct partial_symtab *psymtab, - struct ui_file *outfile) -{ - if ((psymtab == NULL - || psymtab->psymtabs_addrmap_supported) - && partial_symtabs->psymtabs_addrmap != NULL) - { - if (psymtab == nullptr) - gdb_printf (outfile, _("Entire address map:\n")); - else - gdb_printf (outfile, _("Address map:\n")); - addrmap_dump (partial_symtabs->psymtabs_addrmap, outfile, psymtab); - } -} - static void maintenance_print_psymbols (const char *args, int from_tty) { @@ -1564,9 +1477,6 @@ maintenance_print_psymbols (const char *args, int from_tty) if (psf == nullptr) continue; - psymtab_storage *partial_symtabs - = psf->get_partial_symtabs ().get (); - if (address_arg != NULL) { struct bound_minimal_symbol msymbol; @@ -1584,7 +1494,6 @@ maintenance_print_psymbols (const char *args, int from_tty) printed_objfile_header = 1; } dump_psymtab (objfile, ps, outfile); - dump_psymtab_addrmap (objfile, partial_symtabs, ps, outfile); found = 1; } } @@ -1611,21 +1520,9 @@ maintenance_print_psymbols (const char *args, int from_tty) printed_objfile_header = 1; } dump_psymtab (objfile, ps, outfile); - dump_psymtab_addrmap (objfile, partial_symtabs, ps, - outfile); } } } - - /* If we're printing all the objfile's symbols dump the full addrmap. */ - - if (address_arg == NULL - && source_arg == NULL - && partial_symtabs->psymtabs_addrmap != NULL) - { - outfile->puts ("\n"); - dump_psymtab_addrmap (objfile, partial_symtabs, NULL, outfile); - } } } @@ -1694,9 +1591,6 @@ maintenance_info_psymtabs (const char *regexp, int from_tty) gdb_puts (paddress (gdbarch, psymtab->text_high (objfile))); gdb_printf ("\n"); - gdb_printf (" psymtabs_addrmap_supported %s\n", - (psymtab->psymtabs_addrmap_supported - ? "yes" : "no")); gdb_printf (" globals "); if (!psymtab->global_psymbols.empty ()) gdb_printf diff --git a/gdb/psymtab.h b/gdb/psymtab.h index 70eb3e246ba..68ef99edcb5 100644 --- a/gdb/psymtab.h +++ b/gdb/psymtab.h @@ -121,17 +121,6 @@ public: struct partial_symtab *psymtabs = nullptr; - /* Map addresses to the entries of PSYMTABS. It would be more efficient to - have a map per the whole process but ADDRMAP cannot selectively remove - its items during FREE_OBJFILE. This mapping is already present even for - PARTIAL_SYMTABs which still have no corresponding full SYMTABs read. - - The DWARF parser reuses this addrmap to store things other than - psymtabs in the cases where debug information is being read from, for - example, the .debug-names section. */ - - struct addrmap *psymtabs_addrmap = nullptr; - /* A byte cache where we can stash arbitrary "chunks" of bytes that will not change. */