aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-10-23 09:40:54 -0600
committerTom Tromey <tom@tromey.com>2020-01-26 16:40:21 -0700
commit8566b89b737eef50f67bf23329b4606cf7973de1 (patch)
tree022486e22ca850c04d2488ec9913114191a69f91 /gdb/dwarf2read.c
parent077cbab270376098e90c841690f9e4439b63d3d4 (diff)
downloadbinutils-8566b89b737eef50f67bf23329b4606cf7973de1.zip
binutils-8566b89b737eef50f67bf23329b4606cf7973de1.tar.gz
binutils-8566b89b737eef50f67bf23329b4606cf7973de1.tar.bz2
Introduce partial_symtab::expand_psymtab method
The symbol readers generally used two functions to expand a partial symtab: an outer function (now the "read_symtab" method), and an inner function, typically named something like "psymtab_to_symtab". This patch changes this second step to be a method on partial_symtab, and updates all the callers. For legacy_psymtab, a new function pointer member is introduced. This patch enables a subsequent cleanup. gdb/ChangeLog 2020-01-26 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_psymtab_to_symtab_1): Change argument order. Call expand_psymtab. (xcoff_read_symtab): Call expand_psymtab. (xcoff_start_psymtab, xcoff_end_psymtab): Set legacy_expand_psymtab. * psympriv.h (struct partial_symtab) <expand_psymtab>: New method. (struct legacy_psymtab) <expand_psymtab>: Implement. <legacy_expand_psymtab>: New member. * mdebugread.c (mdebug_read_symtab): Call expand_psymtab. (parse_partial_symbols): Set legacy_expand_psymtab. (psymtab_to_symtab_1): Change argument order. Call expand_psymtab. (new_psymtab): Set legacy_expand_psymtab. * dwarf2read.h (struct dwarf2_psymtab) <expand_psymtab>: Declare. * dwarf2read.c (dwarf2_psymtab::read_symtab): Call expand_psymtab. (dwarf2_psymtab::expand_psymtab): Rename from psymtab_to_symtab_1. Call expand_psymtab. * dbxread.c (start_psymtab): Set legacy_expand_psymtab. (dbx_end_psymtab): Likewise. (dbx_psymtab_to_symtab_1): Change argument order. Call expand_psymtab. (dbx_read_symtab): Call expand_psymtab. * ctfread.c (struct ctf_psymtab) <expand_psymtab>: Declare. (ctf_psymtab::expand_psymtab): Rename from psymtab_to_symtab. (ctf_psymtab::read_symtab): Call expand_psymtab. Change-Id: Ic39a2d7aa7b424088d910b59dbd21271fa1c3430
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9942270..c3e0866 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1513,8 +1513,6 @@ static void add_partial_subprogram (struct partial_die_info *pdi,
CORE_ADDR *lowpc, CORE_ADDR *highpc,
int need_pc, struct dwarf2_cu *cu);
-static void psymtab_to_symtab_1 (dwarf2_psymtab *);
-
static abbrev_table_up abbrev_table_read_table
(struct dwarf2_per_objfile *dwarf2_per_objfile, struct dwarf2_section_info *,
sect_offset);
@@ -9510,7 +9508,7 @@ dwarf2_psymtab::read_symtab (struct objfile *objfile)
dwarf2_per_objfile->reading_partial_symbols = 0;
- psymtab_to_symtab_1 (this);
+ expand_psymtab (objfile);
process_cu_includes (dwarf2_per_objfile);
}
@@ -9661,18 +9659,18 @@ process_queue (struct dwarf2_per_objfile *dwarf2_per_objfile)
/* Read in full symbols for PST, and anything it depends on. */
-static void
-psymtab_to_symtab_1 (dwarf2_psymtab *pst)
+void
+dwarf2_psymtab::expand_psymtab (struct objfile *objfile)
{
struct dwarf2_per_cu_data *per_cu;
int i;
- if (pst->readin)
+ if (readin)
return;
- for (i = 0; i < pst->number_of_dependencies; i++)
- if (!pst->dependencies[i]->readin
- && pst->dependencies[i]->user == NULL)
+ for (i = 0; i < number_of_dependencies; i++)
+ if (!dependencies[i]->readin
+ && dependencies[i]->user == NULL)
{
/* Inform about additional files that need to be read in. */
if (info_verbose)
@@ -9682,20 +9680,20 @@ psymtab_to_symtab_1 (dwarf2_psymtab *pst)
wrap_here ("");
fputs_filtered ("and ", gdb_stdout);
wrap_here ("");
- printf_filtered ("%s...", pst->dependencies[i]->filename);
+ printf_filtered ("%s...", dependencies[i]->filename);
wrap_here (""); /* Flush output. */
gdb_flush (gdb_stdout);
}
- psymtab_to_symtab_1 ((dwarf2_psymtab *) pst->dependencies[i]);
+ dependencies[i]->expand_psymtab (objfile);
}
- per_cu = pst->per_cu_data;
+ per_cu = per_cu_data;
if (per_cu == NULL)
{
/* It's an include file, no symbols to read for it.
Everything is in the parent symtab. */
- pst->readin = true;
+ readin = true;
return;
}