From 965a5c32b7ba24badd484aec51b5c3b387ba3fb3 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Sun, 3 Oct 1993 23:04:25 +0000 Subject: [PATCH] Added new slot to objfile struct to be shared by all stab-reading formats. --- gdb/ChangeLog | 10 ++++++++++ gdb/dbxread.c | 14 +++++++++----- gdb/elfread.c | 18 +++++++++--------- gdb/gdb-stabs.h | 4 ++-- gdb/objfiles.h | 5 +++++ gdb/paread.c | 12 ++++++------ 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5aa65ea0438..a0a07279252 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Sun Oct 3 15:54:51 1993 Stan Shebs (shebs@rtl.cygnus.com) + + * objfiles.h (objfile): New slot sym_stab_info, use by all + stab-reading formats. + * gdb-stabs.h (DBX_SYMFILE_INFO): Access sym_stab_info instead of + sym_private. + * coffread.c (coff_symfile_init): Alloc struct for sym_stab_info. + * dbxread.c, elfread.c, paread.c: Change sym_private references to + sym_stab_info references. + Sat Oct 2 19:28:35 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * mipsread.c, objfiles.c, utils.c: Use PTR not void *. RISC/OS diff --git a/gdb/dbxread.c b/gdb/dbxread.c index e55c36a9c3b..9d1a423607f 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -594,7 +594,7 @@ dbx_symfile_init (objfile) unsigned char size_temp[DBX_STRINGTAB_SIZE_SIZE]; /* Allocate struct to keep track of the symfile */ - objfile->sym_private = (PTR) + objfile->sym_stab_info = (PTR) xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info)); /* FIXME POKING INSIDE BFD DATA STRUCTURES */ @@ -696,9 +696,9 @@ static void dbx_symfile_finish (objfile) struct objfile *objfile; { - if (objfile->sym_private != NULL) + if (objfile->sym_stab_info != NULL) { - mfree (objfile -> md, objfile->sym_private); + mfree (objfile -> md, objfile->sym_stab_info); } free_header_files (); } @@ -2056,6 +2056,10 @@ copy_pending (beg, endi, end) return new; } +/* FIXME: The only difference between this and elfstab_build_psymtabs is + the call to install_minimal_symbols for elf. If the differences are + really that small, the code should be shared. */ + /* Scan and build partial symbols for an coff symbol file. The coff file has already been processed to get its minimal symbols. @@ -2094,7 +2098,7 @@ coffstab_build_psymtabs (objfile, section_offsets, mainline, /* There is already a dbx_symfile_info allocated by our caller. It might even contain some info from the coff symtab to help us. */ - info = (struct dbx_symfile_info *) objfile->sym_private; + info = (struct dbx_symfile_info *) objfile->sym_stab_info; DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text"); if (!DBX_TEXT_SECT (objfile)) @@ -2172,7 +2176,7 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline, /* There is already a dbx_symfile_info allocated by our caller. It might even contain some info from the ELF symtab to help us. */ - info = (struct dbx_symfile_info *) objfile->sym_private; + info = (struct dbx_symfile_info *) objfile->sym_stab_info; DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text"); if (!DBX_TEXT_SECT (objfile)) diff --git a/gdb/elfread.c b/gdb/elfread.c index 1276deb1557..9b9e3646d09 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -251,7 +251,7 @@ elf_symtab_read (abfd, addr, objfile) seen any section info for it yet. */ asymbol *filesym = 0; struct dbx_symfile_info *dbx = (struct dbx_symfile_info *) - objfile->sym_private; + objfile->sym_stab_info; unsigned long size; storage_needed = get_symtab_upper_bound (abfd); @@ -472,13 +472,13 @@ elf_symfile_read (objfile, section_offsets, mainline) memset ((char *) &ei, 0, sizeof (ei)); /* Allocate struct to keep track of the symfile */ - objfile->sym_private = (PTR) + objfile->sym_stab_info = (PTR) xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info)); - memset ((char *) objfile->sym_private, 0, sizeof (struct dbx_symfile_info)); + memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info)); make_cleanup (free_elfinfo, (PTR) objfile); /* Process the normal ELF symbol table first. This may write some - chain of info into the dbx_symfile_info in objfile->sym_private, + chain of info into the dbx_symfile_info in objfile->sym_stab_info, which can later be used by elfstab_offset_sections. */ /* FIXME, should take a section_offsets param, not just an offset. */ @@ -535,7 +535,7 @@ elf_symfile_read (objfile, section_offsets, mainline) do_cleanups (back_to); } -/* This cleans up the objfile's sym_private pointer, and the chain of +/* This cleans up the objfile's sym_stab_info pointer, and the chain of stab_section_info's, that might be dangling from it. */ static void @@ -544,7 +544,7 @@ free_elfinfo (objp) { struct objfile *objfile = (struct objfile *)objp; struct dbx_symfile_info *dbxinfo = (struct dbx_symfile_info *) - objfile->sym_private; + objfile->sym_stab_info; struct stab_section_info *ssi, *nssi; ssi = dbxinfo->stab_section_info; @@ -582,9 +582,9 @@ static void elf_symfile_finish (objfile) struct objfile *objfile; { - if (objfile -> sym_private != NULL) + if (objfile -> sym_stab_info != NULL) { - mfree (objfile -> md, objfile -> sym_private); + mfree (objfile -> md, objfile -> sym_stab_info); } } @@ -642,7 +642,7 @@ elfstab_offset_sections (objfile, pst) { char *filename = pst->filename; struct dbx_symfile_info *dbx = (struct dbx_symfile_info *) - objfile->sym_private; + objfile->sym_stab_info; struct stab_section_info *maybe = dbx->stab_section_info; struct stab_section_info *questionable = 0; int i; diff --git a/gdb/gdb-stabs.h b/gdb/gdb-stabs.h index c77a23089d9..706dfd86b84 100644 --- a/gdb/gdb-stabs.h +++ b/gdb/gdb-stabs.h @@ -51,7 +51,7 @@ struct stab_section_info { }; /* Information is passed among various dbxread routines for accessing - symbol files. A pointer to this structure is kept in the sym_private + symbol files. A pointer to this structure is kept in the sym_stab_info field of the objfile struct. */ struct dbx_symfile_info { @@ -65,7 +65,7 @@ struct dbx_symfile_info { of the original .o files before linking. */ }; -#define DBX_SYMFILE_INFO(o) ((struct dbx_symfile_info *)((o)->sym_private)) +#define DBX_SYMFILE_INFO(o) ((struct dbx_symfile_info *)((o)->sym_stab_info)) #define DBX_TEXT_SECT(o) (DBX_SYMFILE_INFO(o)->text_sect) #define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount) #define DBX_STRINGTAB(o) (DBX_SYMFILE_INFO(o)->stringtab) diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 19e7981461a..50226ff47e7 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -270,6 +270,11 @@ struct objfile struct entry_info ei; + /* Information about stabs. Will be filled in with a dbx_symfile_info + struct by those readers that need it. */ + + PTR sym_stab_info; + /* Hook for information for use by the symbol reader (currently used for information shared by sym_init and sym_read). It is typically a pointer to malloc'd memory. The symbol reader's finish diff --git a/gdb/paread.c b/gdb/paread.c index da3ee7d100b..d21aa54d26d 100644 --- a/gdb/paread.c +++ b/gdb/paread.c @@ -325,7 +325,7 @@ pa_symfile_read (objfile, section_offsets, mainline) do_cleanups (back_to); } -/* This cleans up the objfile's sym_private pointer, and the chain of +/* This cleans up the objfile's sym_stab_info pointer, and the chain of stab_section_info's, that might be dangling from it. */ static void @@ -334,7 +334,7 @@ free_painfo (objp) { struct objfile *objfile = (struct objfile *)objp; struct dbx_symfile_info *dbxinfo = (struct dbx_symfile_info *) - objfile->sym_private; + objfile->sym_stab_info; struct stab_section_info *ssi, *nssi; ssi = dbxinfo->stab_section_info; @@ -371,9 +371,9 @@ static void pa_symfile_finish (objfile) struct objfile *objfile; { - if (objfile -> sym_private != NULL) + if (objfile -> sym_stab_info != NULL) { - mfree (objfile -> md, objfile -> sym_private); + mfree (objfile -> md, objfile -> sym_stab_info); } } @@ -401,10 +401,10 @@ pa_symfile_init (objfile) stringsect = bfd_get_section_by_name (sym_bfd, "$GDB_STRINGS$"); /* Allocate struct to keep track of the symfile */ - objfile->sym_private = (PTR) + objfile->sym_stab_info = (PTR) xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info)); - memset ((PTR) objfile->sym_private, 0, sizeof (struct dbx_symfile_info)); + memset ((PTR) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info)); if (!stabsect) return; -- 2.30.2