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/xcoffread.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gdb/xcoffread.c') diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 66d6b9a..1c0db67 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1817,7 +1817,7 @@ find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo) } static void -xcoff_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst) +xcoff_psymtab_to_symtab_1 (legacy_psymtab *pst, struct objfile *objfile) { int i; @@ -1847,8 +1847,7 @@ xcoff_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst) wrap_here (""); /* Flush output */ gdb_flush (gdb_stdout); } - xcoff_psymtab_to_symtab_1 (objfile, - (legacy_psymtab *) pst->dependencies[i]); + pst->dependencies[i]->expand_psymtab (objfile); } if (((struct symloc *) pst->read_symtab_private)->numsyms != 0) @@ -1876,7 +1875,7 @@ xcoff_read_symtab (legacy_psymtab *self, struct objfile *objfile) { next_symbol_text_func = xcoff_next_symbol_text; - xcoff_psymtab_to_symtab_1 (objfile, self); + self->expand_psymtab (objfile); /* Match with global symbols. This only needs to be done once, after all of the symtabs and dependencies have been read in. */ @@ -1997,6 +1996,7 @@ xcoff_start_psymtab (struct objfile *objfile, XOBNEW (&objfile->objfile_obstack, struct symloc); ((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum; result->legacy_read_symtab = xcoff_read_symtab; + result->legacy_expand_psymtab = xcoff_psymtab_to_symtab_1; /* Deduce the source language from the filename for this psymtab. */ psymtab_language = deduce_language_from_filename (filename); @@ -2059,6 +2059,7 @@ xcoff_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 -- cgit v1.1