From 8566b89b737eef50f67bf23329b4606cf7973de1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 23 Oct 2019 09:40:54 -0600 Subject: 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 * 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) : New method. (struct legacy_psymtab) : Implement. : 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) : 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) : Declare. (ctf_psymtab::expand_psymtab): Rename from psymtab_to_symtab. (ctf_psymtab::read_symtab): Call expand_psymtab. Change-Id: Ic39a2d7aa7b424088d910b59dbd21271fa1c3430 --- gdb/psympriv.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gdb/psympriv.h') diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 4c189aa..ae98a69 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -129,6 +129,11 @@ struct partial_symtab table. */ virtual void read_symtab (struct objfile *) = 0; + /* Psymtab expansion is done in two steps. The first step is a call + to read_symtab; but while that is in progress, calls to + expand_psymtab can be made. */ + virtual void expand_psymtab (struct objfile *) = 0; + /* Return the raw low text address of this partial_symtab. */ CORE_ADDR raw_text_low () const { @@ -311,11 +316,21 @@ struct legacy_psymtab : public partial_symtab (*legacy_read_symtab) (this, objf); } + void expand_psymtab (struct objfile *objf) override + { + (*legacy_expand_psymtab) (this, objf); + } + /* Pointer to function which will read in the symtab corresponding to this psymtab. */ void (*legacy_read_symtab) (legacy_psymtab *, struct objfile *) = nullptr; + /* Pointer to function which will actually expand this psymtab into + a full symtab. */ + + void (*legacy_expand_psymtab) (legacy_psymtab *, struct objfile *) = nullptr; + /* Information that lets read_symtab() locate the part of the symbol table that this psymtab corresponds to. This information is private to the format-dependent symbol reading routines. For further detail examine -- cgit v1.1