diff options
author | Tom Tromey <tom@tromey.com> | 2019-10-23 09:40:54 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-01-26 16:40:21 -0700 |
commit | 8566b89b737eef50f67bf23329b4606cf7973de1 (patch) | |
tree | 022486e22ca850c04d2488ec9913114191a69f91 /gdb/dbxread.c | |
parent | 077cbab270376098e90c841690f9e4439b63d3d4 (diff) | |
download | gdb-8566b89b737eef50f67bf23329b4606cf7973de1.zip gdb-8566b89b737eef50f67bf23329b4606cf7973de1.tar.gz gdb-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/dbxread.c')
-rw-r--r-- | gdb/dbxread.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 9d8d938..2711ea8 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -268,7 +268,7 @@ static void read_ofile_symtab (struct objfile *, legacy_psymtab *); static void dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile); -static void dbx_psymtab_to_symtab_1 (struct objfile *, legacy_psymtab *); +static void dbx_psymtab_to_symtab_1 (legacy_psymtab *, struct objfile *); static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *); @@ -1909,6 +1909,7 @@ start_psymtab (struct objfile *objfile, const char *filename, CORE_ADDR textlow, XOBNEW (&objfile->objfile_obstack, struct symloc); LDSYMOFF (result) = ldsymoff; result->legacy_read_symtab = dbx_read_symtab; + result->legacy_expand_psymtab = dbx_psymtab_to_symtab_1; SYMBOL_SIZE (result) = symbol_size; SYMBOL_OFFSET (result) = symbol_table_offset; STRING_OFFSET (result) = string_table_offset; @@ -2039,6 +2040,7 @@ dbx_end_psymtab (struct objfile *objfile, legacy_psymtab *pst, subpst->number_of_dependencies = 1; subpst->legacy_read_symtab = pst->legacy_read_symtab; + subpst->legacy_expand_psymtab = pst->legacy_expand_psymtab; } if (num_includes == 0 @@ -2064,7 +2066,7 @@ dbx_end_psymtab (struct objfile *objfile, legacy_psymtab *pst, } static void -dbx_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst) +dbx_psymtab_to_symtab_1 (legacy_psymtab *pst, struct objfile *objfile) { int i; @@ -2091,8 +2093,7 @@ dbx_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst) wrap_here (""); /* Flush output. */ gdb_flush (gdb_stdout); } - dbx_psymtab_to_symtab_1 (objfile, - (legacy_psymtab *) pst->dependencies[i]); + pst->dependencies[i]->expand_psymtab (objfile); } if (LDSYMLEN (pst)) /* Otherwise it's a dummy. */ @@ -2135,7 +2136,7 @@ dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile) data_holder.reset (stabs_data); } - dbx_psymtab_to_symtab_1 (objfile, self); + self->expand_psymtab (objfile); } /* Match with global symbols. This only needs to be done once, |