From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 16/26] Reference psymtabs via per_bfd in DWARF reader
Date: Sun, 28 Feb 2021 13:37:53 -0700 [thread overview]
Message-ID: <20210228203803.1693413-17-tom@tromey.com> (raw)
In-Reply-To: <20210228203803.1693413-1-tom@tromey.com>
This changes the DWARF reader to reference the psymtabs via the
per_bfd object, rather than via the objfile. This helps isolate the
partial symtabs from the objfile.
gdb/ChangeLog
2021-02-28 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_create_include_psymtab): Add per_bfd
parameter.
(process_psymtab_comp_unit_reader)
(build_type_psymtab_dependencies, dwarf2_build_psymtabs_hard)
(add_partial_subprogram, dwarf2_ranges_read, dwarf_decode_lines):
Reference psymtabs via per_bfd.
---
gdb/ChangeLog | 9 +++++++++
gdb/dwarf2/read.c | 40 +++++++++++++++++++++++-----------------
2 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4008e7dff2f..9aaf484a31e 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -6514,7 +6514,8 @@ struct dwarf2_include_psymtab : public partial_symtab
partial symtab as being an include of PST. */
static void
-dwarf2_create_include_psymtab (const char *name, dwarf2_psymtab *pst,
+dwarf2_create_include_psymtab (dwarf2_per_bfd *per_bfd,
+ const char *name, dwarf2_psymtab *pst,
struct objfile *objfile)
{
dwarf2_include_psymtab *subpst = new dwarf2_include_psymtab (name, objfile);
@@ -6522,7 +6523,7 @@ dwarf2_create_include_psymtab (const char *name, dwarf2_psymtab *pst,
if (!IS_ABSOLUTE_PATH (subpst->filename))
subpst->dirname = pst->dirname;
- subpst->dependencies = objfile->partial_symtabs->allocate_dependencies (1);
+ subpst->dependencies = per_bfd->partial_symtabs->allocate_dependencies (1);
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;
}
@@ -7792,6 +7793,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
{
struct dwarf2_cu *cu = reader->cu;
dwarf2_per_objfile *per_objfile = cu->per_objfile;
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
struct objfile *objfile = per_objfile->objfile;
struct gdbarch *gdbarch = objfile->arch ();
struct dwarf2_per_cu_data *per_cu = cu->per_cu;
@@ -7842,7 +7844,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
- baseaddr - 1);
/* Store the contiguous range if it is not empty; it can be
empty for CUs with no code. */
- addrmap_set_empty (objfile->partial_symtabs->psymtabs_addrmap,
+ addrmap_set_empty (per_bfd->partial_symtabs->psymtabs_addrmap,
low, high, pst);
}
@@ -7893,7 +7895,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
post-pass. */
pst->number_of_dependencies = len;
pst->dependencies
- = objfile->partial_symtabs->allocate_dependencies (len);
+ = per_bfd->partial_symtabs->allocate_dependencies (len);
for (i = 0; i < len; ++i)
{
pst->dependencies[i]
@@ -8149,7 +8151,7 @@ static int
build_type_psymtab_dependencies (void **slot, void *info)
{
dwarf2_per_objfile *per_objfile = (dwarf2_per_objfile *) info;
- struct objfile *objfile = per_objfile->objfile;
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
struct type_unit_group *tu_group = (struct type_unit_group *) *slot;
struct dwarf2_per_cu_data *per_cu = &tu_group->per_cu;
dwarf2_psymtab *pst = per_cu->v.psymtab;
@@ -8160,7 +8162,7 @@ build_type_psymtab_dependencies (void **slot, void *info)
gdb_assert (per_cu->type_unit_group_p ());
pst->number_of_dependencies = len;
- pst->dependencies = objfile->partial_symtabs->allocate_dependencies (len);
+ pst->dependencies = per_bfd->partial_symtabs->allocate_dependencies (len);
for (i = 0; i < len; ++i)
{
struct signatured_type *iter = tu_group->tus->at (i);
@@ -8284,6 +8286,7 @@ static void
dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
{
struct objfile *objfile = per_objfile->objfile;
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
dwarf_read_debug_printf ("Building psymtabs of objfile %s ...",
objfile_name (objfile));
@@ -8292,7 +8295,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
= make_scoped_restore (&per_objfile->per_bfd->reading_partial_symbols,
true);
- per_objfile->per_bfd->info.read (objfile);
+ per_bfd->info.read (objfile);
/* Any cached compilation units will be linked by the per-objfile
read_in_chain. Make sure to free them when we're done. */
@@ -8307,10 +8310,10 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
auto_obstack temp_obstack;
scoped_restore save_psymtabs_addrmap
- = make_scoped_restore (&objfile->partial_symtabs->psymtabs_addrmap,
+ = make_scoped_restore (&per_bfd->partial_symtabs->psymtabs_addrmap,
addrmap_create_mutable (&temp_obstack));
- for (dwarf2_per_cu_data *per_cu : per_objfile->per_bfd->all_comp_units)
+ for (dwarf2_per_cu_data *per_cu : per_bfd->all_comp_units)
{
if (per_cu->v.psymtab != NULL)
/* In case a forward DW_TAG_imported_unit has read the CU already. */
@@ -8323,9 +8326,9 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
process_skeletonless_type_units (per_objfile);
/* Now that all TUs have been processed we can fill in the dependencies. */
- if (per_objfile->per_bfd->type_unit_groups != NULL)
+ if (per_bfd->type_unit_groups != NULL)
{
- htab_traverse_noresize (per_objfile->per_bfd->type_unit_groups.get (),
+ htab_traverse_noresize (per_bfd->type_unit_groups.get (),
build_type_psymtab_dependencies, per_objfile);
}
@@ -8334,9 +8337,9 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
set_partial_user (per_objfile);
- objfile->partial_symtabs->psymtabs_addrmap
- = addrmap_create_fixed (objfile->partial_symtabs->psymtabs_addrmap,
- objfile->partial_symtabs->obstack ());
+ per_bfd->partial_symtabs->psymtabs_addrmap
+ = addrmap_create_fixed (per_bfd->partial_symtabs->psymtabs_addrmap,
+ per_bfd->partial_symtabs->obstack ());
/* At this point we want to keep the address map. */
save_psymtabs_addrmap.release ();
@@ -8951,6 +8954,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
if (set_addrmap)
{
struct objfile *objfile = cu->per_objfile->objfile;
+ dwarf2_per_bfd *per_bfd = cu->per_objfile->per_bfd;
struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR baseaddr;
CORE_ADDR this_highpc;
@@ -8965,7 +8969,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
= (gdbarch_adjust_dwarf2_addr (gdbarch,
pdi->highpc + baseaddr)
- baseaddr);
- addrmap_set_empty (objfile->partial_symtabs->psymtabs_addrmap,
+ addrmap_set_empty (per_bfd->partial_symtabs->psymtabs_addrmap,
this_lowpc, this_highpc - 1,
cu->per_cu->v.psymtab);
}
@@ -14735,6 +14739,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
dwarf2_psymtab *ranges_pst, dwarf_tag tag)
{
struct objfile *objfile = cu->per_objfile->objfile;
+ dwarf2_per_bfd *per_bfd = cu->per_objfile->per_bfd;
struct gdbarch *gdbarch = objfile->arch ();
const CORE_ADDR baseaddr = objfile->text_section_offset ();
int low_set = 0;
@@ -14756,7 +14761,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
highpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
range_end + baseaddr)
- baseaddr);
- addrmap_set_empty (objfile->partial_symtabs->psymtabs_addrmap,
+ addrmap_set_empty (per_bfd->partial_symtabs->psymtabs_addrmap,
lowpc, highpc - 1, ranges_pst);
}
@@ -22085,7 +22090,8 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
psymtab_include_file_name (lh, file_entry, pst,
comp_dir, &name_holder);
if (include_name != NULL)
- dwarf2_create_include_psymtab (include_name, pst, objfile);
+ dwarf2_create_include_psymtab (cu->per_objfile->per_bfd,
+ include_name, pst, objfile);
}
}
else
--
2.26.2
next prev parent reply other threads:[~2021-02-28 20:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 20:37 [PATCH 00/26] Allow multiple "partial" symtab readers per objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 01/26] Move some DWARF code out of symfile.h Tom Tromey
2021-02-28 20:37 ` [PATCH 02/26] Introduce dwarf2/public.h Tom Tromey
2021-02-28 20:37 ` [PATCH 03/26] Change objfile_has_partial_symbols to a method Tom Tromey
2021-02-28 20:37 ` [PATCH 04/26] Change objfile::has_partial_symbols to return bool Tom Tromey
2021-02-28 20:37 ` [PATCH 05/26] Introduce method wrappers for quick_symbol_functions Tom Tromey
2021-03-22 13:52 ` Simon Marchi
2021-02-28 20:37 ` [PATCH 06/26] Move quick_symbol_functions to a new header Tom Tromey
2021-02-28 20:37 ` [PATCH 07/26] Move sym_fns::qf to objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 08/26] Convert quick_symbol_functions to use methods Tom Tromey
2021-02-28 20:37 ` [PATCH 09/26] Move psymbol_map out of objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 10/26] Change how some psymbol readers access the psymtab storage Tom Tromey
2021-02-28 20:37 ` [PATCH 11/26] Do not pass objfile to psymtab_discarder Tom Tromey
2021-02-28 20:37 ` [PATCH 12/26] Set per_bfd->partial_symtabs earlier Tom Tromey
2021-02-28 20:37 ` [PATCH 13/26] Change how DWARF indices use addrmap Tom Tromey
2021-02-28 20:37 ` [PATCH 14/26] Move psymtab statistics printing to psymtab.c Tom Tromey
2021-02-28 20:37 ` [PATCH 15/26] Change how DWARF index writer finds address map Tom Tromey
2021-02-28 20:37 ` Tom Tromey [this message]
2021-02-28 20:37 ` [PATCH 17/26] Attach partial symtab storage to psymbol_functions Tom Tromey
2021-02-28 20:37 ` [PATCH 18/26] Rearrange psymtab_storage construction Tom Tromey
2021-02-28 20:37 ` [PATCH 19/26] Remove sym_fns::sym_read_psymbols Tom Tromey
2021-02-28 20:37 ` [PATCH 20/26] Introduce objfile::require_partial_symbols Tom Tromey
2021-02-28 20:37 ` [PATCH 21/26] Add partial_symtabs parameter to psymtab construction functions Tom Tromey
2021-02-28 20:37 ` [PATCH 22/26] Remove last objfile partial_symtab references from psymtab.c Tom Tromey
2021-02-28 20:38 ` [PATCH 23/26] Change count_psyms to be a method on psymbol_functions Tom Tromey
2021-02-28 20:38 ` [PATCH 24/26] Remove objfile::psymtabs Tom Tromey
2021-02-28 20:38 ` [PATCH 25/26] Switch objfile to hold a list of psymbol readers Tom Tromey
2021-02-28 20:38 ` [PATCH 26/26] Allow multiple partial symbol readers per objfile Tom Tromey
2021-03-20 23:33 ` [PATCH 00/26] Allow multiple "partial" symtab " Tom Tromey
2021-03-22 14:13 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210228203803.1693413-17-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).