diff options
author | Tom Tromey <tromey@adacore.com> | 2019-06-07 15:01:50 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-06-10 07:23:33 -0600 |
commit | caa429d81a9999699a40b6394c9fb7b258669d54 (patch) | |
tree | d187635e25600efbb6e97f688ac500daed5f7907 /gdb/dbxread.c | |
parent | 2e02f29632218fc24d71fbbefc368d551d0528a7 (diff) | |
download | gdb-caa429d81a9999699a40b6394c9fb7b258669d54.zip gdb-caa429d81a9999699a40b6394c9fb7b258669d54.tar.gz gdb-caa429d81a9999699a40b6394c9fb7b258669d54.tar.bz2 |
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.
Diffstat (limited to 'gdb/dbxread.c')
-rw-r--r-- | gdb/dbxread.c | 10 |
1 files changed, 10 insertions, 0 deletions
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); |