public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Delay allocation of dbx_symfile_info Date: Mon, 10 Jun 2019 13:24:00 -0000 [thread overview] Message-ID: <20190610132447.4471.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=caa429d81a9999699a40b6394c9fb7b258669d54 commit caa429d81a9999699a40b6394c9fb7b258669d54 Author: Tom Tromey <tromey@adacore.com> Date: Fri Jun 7 15:01:50 2019 -0600 Delay allocation of dbx_symfile_info I noticed that elfread.c always allocates a dbx_symfile_info, even though this is only ever needed in the unusual case of reading stabs in ELF. This patch moves the allocation into dbxread.c, and applies the same treatment to similar code in coffread.c. Regression tested on x86-64 Fedora 29. gdb/ChangeLog 2019-06-10 Tom Tromey <tromey@adacore.com> * elfread.c (elf_read_minimal_symbols): Don't set the dbx objfile data. (elf_new_init): Don't call stabsread_new_init. * dbxread.c (coffstab_build_psymtabs): Set dbx objfile data. (elfstab_build_psymtabs): Likewise. Call stabsread_new_init. * coffread.c (coff_symfile_init): Don't set the dbx objfile data. Diff: --- gdb/ChangeLog | 9 +++++++++ gdb/coffread.c | 7 ------- gdb/dbxread.c | 10 ++++++++++ gdb/elfread.c | 12 +----------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3a40ecc..795ba45 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2019-06-10 Tom Tromey <tromey@adacore.com> + + * elfread.c (elf_read_minimal_symbols): Don't set the dbx objfile + data. + (elf_new_init): Don't call stabsread_new_init. + * dbxread.c (coffstab_build_psymtabs): Set dbx objfile data. + (elfstab_build_psymtabs): Likewise. Call stabsread_new_init. + * coffread.c (coff_symfile_init): Don't set the dbx objfile data. + 2019-06-10 Tom de Vries <tdevries@suse.de> PR symtab/16264 diff --git a/gdb/coffread.c b/gdb/coffread.c index 0956f38..6e379dd 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -31,7 +31,6 @@ #include "libcoff.h" /* FIXME secret internal data from BFD */ #include "objfiles.h" #include "buildsym-legacy.h" -#include "gdb-stabs.h" #include "stabsread.h" #include "complaints.h" #include "target.h" @@ -484,12 +483,6 @@ record_minimal_symbol (minimal_symbol_reader &reader, static void coff_symfile_init (struct objfile *objfile) { - struct dbx_symfile_info *dbx; - - /* Allocate struct to keep track of stab reading. */ - dbx = XCNEW (struct dbx_symfile_info); - set_objfile_data (objfile, dbx_objfile_data_key, dbx); - /* Allocate struct to keep track of the symfile. */ coff_objfile_data_key.emplace (objfile); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index ad2edc3..307debd 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2951,6 +2951,10 @@ coffstab_build_psymtabs (struct objfile *objfile, char *name = bfd_get_filename (sym_bfd); unsigned int stabsize; + /* Allocate struct to keep track of stab reading. */ + struct dbx_symfile_info *dbx = XCNEW (struct dbx_symfile_info); + set_objfile_data (objfile, dbx_objfile_data_key, dbx); + DBX_TEXT_ADDR (objfile) = textaddr; DBX_TEXT_SIZE (objfile) = textsize; @@ -3034,6 +3038,12 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect, bfd *sym_bfd = objfile->obfd; char *name = bfd_get_filename (sym_bfd); + stabsread_new_init (); + + /* Allocate struct to keep track of stab reading. */ + struct dbx_symfile_info *dbx = XCNEW (struct dbx_symfile_info); + set_objfile_data (objfile, dbx_objfile_data_key, dbx); + /* Find the first and last text address. dbx_symfile_read seems to want this. */ find_text_range (sym_bfd, objfile); diff --git a/gdb/elfread.c b/gdb/elfread.c index cb98b83..630550b 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -29,7 +29,6 @@ #include "symfile.h" #include "objfiles.h" #include "stabsread.h" -#include "gdb-stabs.h" #include "complaints.h" #include "demangle.h" #include "psympriv.h" @@ -1039,7 +1038,6 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags, long symcount = 0, dynsymcount = 0, synthcount, storage_needed; asymbol **symbol_table = NULL, **dyn_symbol_table = NULL; asymbol *synthsyms; - struct dbx_symfile_info *dbx; if (symtab_create_debug) { @@ -1065,10 +1063,6 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags, minimal_symbol_reader reader (objfile); - /* Allocate struct to keep track of the symfile. */ - dbx = XCNEW (struct dbx_symfile_info); - set_objfile_data (objfile, dbx_objfile_data_key, dbx); - /* Process the normal ELF symbol table first. */ storage_needed = bfd_get_symtab_upper_bound (objfile->obfd); @@ -1316,15 +1310,11 @@ read_psyms (struct objfile *objfile) /* Initialize anything that needs initializing when a completely new symbol file is specified (not just adding some symbols from another file, e.g. a - shared library). - - We reinitialize buildsym, since we may be reading stabs from an ELF - file. */ + shared library). */ static void elf_new_init (struct objfile *ignore) { - stabsread_new_init (); } /* Perform any local cleanups required when we are done with a particular
reply other threads:[~2019-06-10 13:24 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190610132447.4471.qmail@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).