aboutsummaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-12-12 15:57:01 +0000
committerTom Tromey <tromey@redhat.com>2012-12-12 15:57:01 +0000
commitd2f4b8feb92563f328897af142d05e796cde26bd (patch)
treeb3fb6822baded1c0640c974c34536d975fdeb256 /gdb/elfread.c
parent6f112b1867d994eb26ba56c5a47400fb715f0214 (diff)
downloadgdb-d2f4b8feb92563f328897af142d05e796cde26bd.zip
gdb-d2f4b8feb92563f328897af142d05e796cde26bd.tar.gz
gdb-d2f4b8feb92563f328897af142d05e796cde26bd.tar.bz2
* coffread.c (coff_symfile_init): Use set_objfile_data.
(coff_symfile_read): Use DBX_SYMFILE_INFO. * dbxread.c (dbx_objfile_data_key): New global. (dbx_symfile_init): Use set_objfile_data. (dbx_symfile_finish): Don't free deprecated_sym_stab_info. (dbx_free_symfile_info): New function. (coffstab_build_psymtabs, elfstab_build_psymtabs): Use DBX_SYMFILE_INFO. (stabsect_build_psymtabs): Use set_objfile_data. (_initialize_dbxreadb): Initialize dbx_objfile_data_key. * elfread.c (elf_symtab_read): Use DBX_SYMFILE_INFO, set_objfile_data. (free_elfinfo): Use DBX_SYMFILE_INFO. (elf_symfile_finish): Don't free deprecated_sym_stab_info. (elfstab_offset_sections): Use DBX_SYMFILE_INFO. * gdb-stabs.h (dbx_objfile_data_key): Declare. (DBX_SYMFILE_INFO): Rewrite to use objfile_data. * objfiles.h (struct objfile) <deprecated_sym_stab_info>: Remove. * somread.c (som_symfile_finish): Don't free deprecated_sym_stab_info.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 84efc59..29d5836 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -248,7 +248,7 @@ elf_symtab_read (struct objfile *objfile, int type,
/* Name of filesym. This is either a constant string or is saved on
the objfile's filename cache. */
const char *filesymname = "";
- struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info;
+ struct dbx_symfile_info *dbx = DBX_SYMFILE_INFO (objfile);
int stripped = (bfd_get_symcount (objfile->obfd) == 0);
for (i = 0; i < number_of_symbols; i++)
@@ -1251,6 +1251,7 @@ elf_symfile_read (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)
{
@@ -1265,16 +1266,13 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
memset ((char *) &ei, 0, sizeof (ei));
/* Allocate struct to keep track of the symfile. */
- objfile->deprecated_sym_stab_info = (struct dbx_symfile_info *)
- xmalloc (sizeof (struct dbx_symfile_info));
- memset ((char *) objfile->deprecated_sym_stab_info,
- 0, sizeof (struct dbx_symfile_info));
+ dbx = XCNEW (struct dbx_symfile_info);
+ set_objfile_data (objfile, dbx_objfile_data_key, dbx);
make_cleanup (free_elfinfo, (void *) objfile);
/* Process the normal ELF symbol table first. This may write some
- chain of info into the dbx_symfile_info in
- objfile->deprecated_sym_stab_info, which can later be used by
- elfstab_offset_sections. */
+ chain of info into the dbx_symfile_info of the objfile, which can
+ later be used by elfstab_offset_sections. */
storage_needed = bfd_get_symtab_upper_bound (objfile->obfd);
if (storage_needed < 0)
@@ -1467,15 +1465,14 @@ read_psyms (struct objfile *objfile)
dwarf2_build_psymtabs (objfile);
}
-/* This cleans up the objfile's deprecated_sym_stab_info pointer, and
- the chain of stab_section_info's, that might be dangling from
- it. */
+/* This cleans up the objfile's dbx symfile info, and the chain of
+ stab_section_info's, that might be dangling from it. */
static void
free_elfinfo (void *objp)
{
struct objfile *objfile = (struct objfile *) objp;
- struct dbx_symfile_info *dbxinfo = objfile->deprecated_sym_stab_info;
+ struct dbx_symfile_info *dbxinfo = DBX_SYMFILE_INFO (objfile);
struct stab_section_info *ssi, *nssi;
ssi = dbxinfo->stab_section_info;
@@ -1512,11 +1509,6 @@ elf_new_init (struct objfile *ignore)
static void
elf_symfile_finish (struct objfile *objfile)
{
- if (objfile->deprecated_sym_stab_info != NULL)
- {
- xfree (objfile->deprecated_sym_stab_info);
- }
-
dwarf2_free_objfile (objfile);
}
@@ -1550,7 +1542,7 @@ void
elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
{
const char *filename = pst->filename;
- struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info;
+ struct dbx_symfile_info *dbx = DBX_SYMFILE_INFO (objfile);
struct stab_section_info *maybe = dbx->stab_section_info;
struct stab_section_info *questionable = 0;
int i;