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.
This commit is contained in:
Tom Tromey
2019-06-07 15:01:50 -06:00
parent 2e02f29632
commit caa429d81a
4 changed files with 20 additions and 18 deletions

View File

@@ -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);