From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 572013856260; Sun, 12 Jun 2022 16:56:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 572013856260 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove psymtab_addrmap X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 93b527ef787b7c98611abd21bdd77de6c41769f1 X-Git-Newrev: 32681b482a3a38e240100ddd00280a3db5716874 Message-Id: <20220612165606.572013856260@sourceware.org> Date: Sun, 12 Jun 2022 16:56:06 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jun 2022 16:56:06 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D32681b482a3a= 38e240100ddd00280a3db5716874 commit 32681b482a3a38e240100ddd00280a3db5716874 Author: Tom Tromey Date: Sat Apr 16 10:19:41 2022 -0600 Remove psymtab_addrmap =20 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: --- gdb/dwarf2/read.c | 4 +- gdb/psympriv.h | 16 +++----- gdb/psymtab.c | 108 +-------------------------------------------------= ---- gdb/psymtab.h | 11 ------ 4 files changed, 8 insertions(+), 131 deletions(-) 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 } =20 /* Read the address map data from the mapped index, and use it to - populate the psymtabs_addrmap. */ + populate the index_addrmap. */ =20 static void create_addrmap_from_index (dwarf2_per_objfile *per_objfile, @@ -2485,7 +2485,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_ob= jfile, } =20 /* Read the address map data from DWARF-5 .debug_aranges, and use it to - populate the psymtabs_addrmap. */ + populate the index_addrmap. */ =20 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 =3D nullptr; =20 /* Range of text addresses covered by this file; texthigh is the - beginning of the next section. Do not use if PSYMTABS_ADDRMAP_SUPPOR= TED - 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. */ =20 CORE_ADDR m_text_low =3D 0; CORE_ADDR m_text_high =3D 0; @@ -343,12 +343,6 @@ struct partial_symtab =20 std::vector static_psymbols; =20 - /* True iff objfile->psymtabs_addrmap is properly populated for this - partial_symtab. For discontiguous overlapping psymtabs is the only u= sable - info in PSYMTABS_ADDRMAP. */ - - bool psymtabs_addrmap_supported =3D false; - /* True if the name of this partial symtab is not a source file name. */ =20 bool anonymous =3D 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 =3D pst; CORE_ADDR best_addr =3D pst->text_low (objfile); =20 - 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 objfil= e *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 ne= ed - to take care as the PSYMTABS_ADDRMAP can hold things other than parti= al - symtabs in some cases. - - This function should only be called for objfiles that are using parti= al - symtabs, not for objfiles that are using indexes (.gdb_index or - .debug_names), however 'maintenance print psymbols' calls this functi= on - directly for all objfiles. If we assume that PSYMTABS_ADDRMAP contai= ns - 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 !=3D NULL - && m_partial_symtabs->psymtabs_addrmap !=3D NULL) - { - CORE_ADDR baseaddr =3D objfile->text_section_offset (); - - struct partial_symtab *pst - =3D ((struct partial_symtab *) - m_partial_symtabs->psymtabs_addrmap->find (pc - baseaddr)); - if (pst !=3D 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 !=3D NULL && section !=3D 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 =3D find_pc_sect_psymbol (objfile, pst, pc, section); - if (p =3D=3D NULL - || (p->address (objfile) - !=3D 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 >=3D pst->text_low (objfile) && pc < pst->text_high (objfile)) + if (pc >=3D pst->text_low (objfile) && pc < pst->text_high (objfile)) { struct partial_symtab *best_pst; =20 @@ -780,8 +716,6 @@ dump_psymtab (struct objfile *objfile, struct partial_s= ymtab *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 =3D 0; i < psymtab->number_of_dependencies; i++) @@ -1450,27 +1384,6 @@ psymtab_storage::discard_psymtab (struct partial_sym= tab *pst) =20 =0C =20 -/* 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 =3D=3D NULL - || psymtab->psymtabs_addrmap_supported) - && partial_symtabs->psymtabs_addrmap !=3D NULL) - { - if (psymtab =3D=3D 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 fro= m_tty) if (psf =3D=3D nullptr) continue; =20 - psymtab_storage *partial_symtabs - =3D psf->get_partial_symtabs ().get (); - if (address_arg !=3D NULL) { struct bound_minimal_symbol msymbol; @@ -1584,7 +1494,6 @@ maintenance_print_psymbols (const char *args, int fro= m_tty) printed_objfile_header =3D 1; } dump_psymtab (objfile, ps, outfile); - dump_psymtab_addrmap (objfile, partial_symtabs, ps, outfile); found =3D 1; } } @@ -1611,21 +1520,9 @@ maintenance_print_psymbols (const char *args, int fr= om_tty) printed_objfile_header =3D 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 =3D=3D NULL - && source_arg =3D=3D NULL - && partial_symtabs->psymtabs_addrmap !=3D NULL) - { - outfile->puts ("\n"); - dump_psymtab_addrmap (objfile, partial_symtabs, NULL, outfile); - } } } =20 @@ -1694,9 +1591,6 @@ maintenance_info_psymtabs (const char *regexp, int fr= om_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: =20 struct partial_symtab *psymtabs =3D nullptr; =20 - /* 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 =3D nullptr; - /* A byte cache where we can stash arbitrary "chunks" of bytes that will not change. */