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/ctfread.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'gdb/ctfread.c') diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 120c7b4..77cdcd4 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -124,6 +124,7 @@ struct ctf_psymtab : public partial_symtab } void read_symtab (struct objfile *) override; + void expand_psymtab (struct objfile *) override; struct ctf_context *context; }; @@ -160,8 +161,6 @@ struct ctf_field_info /* Local function prototypes */ -static void psymtab_to_symtab (ctf_psymtab *); - static int ctf_add_type_cb (ctf_id_t tid, void *arg); static struct type *read_array_type (struct ctf_context *cp, ctf_id_t tid); @@ -1216,15 +1215,15 @@ ctf_end_symtab (ctf_psymtab *pst, /* Read in full symbols for PST, and anything it depends on. */ -static void -psymtab_to_symtab (ctf_psymtab *pst) +void +ctf_psymtab::expand_psymtab (struct objfile *objfile) { struct symbol *sym; struct ctf_context *ccp; - gdb_assert (!pst->readin); + gdb_assert (!readin); - ccp = pst->context; + ccp = context; /* Iterate over entries in data types section. */ if (ctf_type_iter (ccp->fp, ctf_add_type_cb, ccp) == CTF_ERR) @@ -1254,7 +1253,7 @@ psymtab_to_symtab (ctf_psymtab *pst) set_symbol_address (ccp->of, sym, sym->linkage_name ()); } - pst->readin = true; + readin = true; } /* Expand partial symbol table PST into a full symbol table. @@ -1279,7 +1278,7 @@ ctf_psymtab::read_symtab (struct objfile *objfile) offset = get_objfile_text_range (objfile, &tsize); ctf_start_symtab (this, objfile, offset); - psymtab_to_symtab (this); + expand_psymtab (objfile); set_text_low (offset); set_text_high (offset + tsize); -- cgit v1.1