From 0494dbecdfa0b0b9065393755a1ac64431997da1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 23 Oct 2019 09:46:25 -0600 Subject: Consolidate partial symtab dependency reading Most of the symbol readers have code to iterate over a partial symtabs dependencies, expanding each one and optionally printing a message. Now that the "second-stage" psymtab expansion is available as a method, these implementations can all be merged. This patch also changes a couple more warnings into assertions. gdb/ChangeLog 2020-01-26 Tom Tromey * xcoffread.c (xcoff_psymtab_to_symtab_1): Call read_dependencies. Add assert. * psymtab.c (partial_symtab::read_dependencies): New method. * psympriv.h (struct partial_symtab) : New method. * mdebugread.c (psymtab_to_symtab_1): Call read_dependencies. * dwarf2read.c (dwarf2_psymtab::expand_psymtab): Call read_dependencies. * dbxread.c (dbx_psymtab_to_symtab_1): Call read_dependencies. Add assert. Change-Id: I8151e05677794e90223edc1a4cb70f7f69137d46 --- gdb/psymtab.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gdb/psymtab.c') diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 6abc829..c020d15 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1682,6 +1682,32 @@ partial_symtab::partial_symtab (const char *filename_, struct objfile *objfile) } } +/* See psympriv.h. */ + +void +partial_symtab::read_dependencies (struct objfile *objfile) +{ + for (int i = 0; i < number_of_dependencies; ++i) + { + if (!dependencies[i]->readin) + { + /* Inform about additional files to be read in. */ + if (info_verbose) + { + fputs_filtered (" ", gdb_stdout); + wrap_here (""); + fputs_filtered ("and ", gdb_stdout); + wrap_here (""); + printf_filtered ("%s...", dependencies[i]->filename); + wrap_here (""); /* Flush output */ + gdb_flush (gdb_stdout); + } + dependencies[i]->expand_psymtab (objfile); + } + } +} + + void psymtab_storage::discard_psymtab (struct partial_symtab *pst) { -- cgit v1.1