From 0072c873792829e2be43acf8bbf1c352c266e4c7 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 2 Apr 2021 11:45:25 -0400 Subject: gdb: pass objfile_per_bfd_storage instead of objfile to partial_symtab Since partial_symtab is supposed to be objfile-independent (since series [1]), I think it would make sense for partial_symtab to not take an objfile as a parameter in its constructor. This patch replaces that parameter with an objfile_per_bfd_storage parameter. The objfile is used for two things: - to get the objfile_name, for debug messages. We can get that name from the bfd instead. - to intern the partial symtab filename. Even though it goes through an objfile method, the request is actually forwarded to the underlying objfile_per_bfd_storage. So we can ask the new objfile_per_bfd_storage instead. In order to get a reference to the BFD from the objfile_per_bfd_storage, the BFD is saved in the objfile_per_bfd_storage object. [1] https://sourceware.org/pipermail/gdb-patches/2021-February/176625.html gdb/ChangeLog: * psympriv.h (struct partial_symtab) : Change objfile parameter for objfile_per_bfd_storage, adjust callers. (struct standard_psymtab) : Likewise. (struct legacy_psymtab) : Likewise. * psymtab.c (partial_symtab::partial_symtab): Likewise. * ctfread.c (struct ctf_psymtab): Likewise. * dwarf2/read.h (struct dwarf2_psymtab): Likewise. * dwarf2/read.c (struct dwarf2_include_psymtab): Likewise. (dwarf2_create_include_psymtab): Likewise. * objfiles.h (struct objfile_per_bfd_storage) : Add bfd parameter, adjust callers. : New method. : New field. * objfiles.c (get_objfile_bfd_data): Adjust. Change-Id: I2ed3ab5d2e6f27d034bd4dc26ae2fae7b0b8a2b9 --- gdb/mdebugread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/mdebugread.c') diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 7bf4564..026f2ff 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -2605,8 +2605,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, textlow = fh->adr; else textlow = 0; - pst = new legacy_psymtab (fdr_name (fh), partial_symtabs, objfile, - textlow); + pst = new legacy_psymtab (fdr_name (fh), partial_symtabs, + objfile->per_bfd, textlow); pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc); memset (pst->read_symtab_private, 0, sizeof (struct symloc)); @@ -4646,7 +4646,7 @@ new_psymtab (const char *name, psymtab_storage *partial_symtabs, { legacy_psymtab *psymtab; - psymtab = new legacy_psymtab (name, partial_symtabs, objfile); + psymtab = new legacy_psymtab (name, partial_symtabs, objfile->per_bfd); /* Keep a backpointer to the file's symbols. */ -- cgit v1.1