aboutsummaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-03-19 21:57:15 +0000
committerFred Fish <fnf@specifix.com>1992-03-19 21:57:15 +0000
commit80d68b1d49a92b6ea0b5b79d9be413f0002ae200 (patch)
tree6a042b0583d1b178e375b6288dc7d2811c763d90 /gdb/elfread.c
parentdc52fc71183fc32594388a619c4fa55e83648ced (diff)
downloadgdb-80d68b1d49a92b6ea0b5b79d9be413f0002ae200.zip
gdb-80d68b1d49a92b6ea0b5b79d9be413f0002ae200.tar.gz
gdb-80d68b1d49a92b6ea0b5b79d9be413f0002ae200.tar.bz2
* coffread.c, mipsread.c, xcoffread.c, coffread.c, dbxread.c,
elfread.c (coff_symfile_finish): Add function, prototype, and add to the xxxx_sym_fns struct for each file type. Also reformat the xxxx_sym_fns vector to a standard format and add comments. * coffread.c, mipsread.c, xcoffread.c, coffread.c, dbxread.c, elfread.c (xxx_symfile_new_init, xxx_symfile_init, xxx_symfile_read): Pass pointer to struct objfile rather than pointer to sym_fns. Change references inside each function accordingly. Allocate any symbol file specific info in the per-objfile memory region. * dbxread.c (free_and_init_header_files): Break function into free_header_files(), called from dbx_symfile_finish(), and init_header_files(), called from dbx_new_init(). * dbxread.c (dbx_new_init): Move deallocation things to new dbx_symfile_finish function. * elfread.c (elf_new_init): Call buildsym_new_init(). * objfiles.c (free_objfile): Call the appropriate symfile_finish() routine for the objfile before deallocating other stuff. * sparc-tdep.c (get_longjmp_target): Cast target_read_memory arg. * symfile.h: Move struct sym_fns to before struct objfile def. Add sym_finish function pointer and change prototypes of other function pointers to reflect passing struct objfile pointer rather than struct sym_fns pointer. * symfile.c: Remove now obsolete symtab_fns pointer. * symfile.c (symfile_init): Renamed to find_sym_fns, and now only locates the correct sym_fns struct for the given objfile. * symfile.c (syms_from_objfile, symbol_file_add): Restructured for better support of mapped symbol tables. * symfile.c (symbol_file_command): Remove obsolete code using symfile_fns. * symfile.h: Remove duplicate declarations for symfile_objfile, entry_point, and object_files. * target.c (target_info): Compare symfile_objfile to NULL. * xcoffread.c (aixcoff_new_init): Move deallocation stuff to aixcoff_symfile_finish().
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 6a89778..f49916c 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -50,13 +50,16 @@ struct elfinfo {
};
static void
-elf_symfile_init PARAMS ((struct sym_fns *));
+elf_symfile_init PARAMS ((struct objfile *));
static void
-elf_new_init PARAMS ((void));
+elf_new_init PARAMS ((struct objfile *));
static void
-elf_symfile_read PARAMS ((struct sym_fns *, CORE_ADDR, int));
+elf_symfile_read PARAMS ((struct objfile *, CORE_ADDR, int));
+
+static void
+elf_symfile_finish PARAMS ((struct objfile *));
static void
elf_symtab_read PARAMS ((bfd *, CORE_ADDR, int, struct objfile *));
@@ -271,12 +274,12 @@ elf_symtab_read (abfd, addr, mainline, objfile)
*/
static void
-elf_symfile_read (sf, addr, mainline)
- struct sym_fns *sf;
+elf_symfile_read (objfile, addr, mainline)
+ struct objfile *objfile;
CORE_ADDR addr;
int mainline;
{
- bfd *abfd = sf->objfile->obfd;
+ bfd *abfd = objfile->obfd;
struct elfinfo ei;
struct cleanup *back_to;
@@ -285,7 +288,7 @@ elf_symfile_read (sf, addr, mainline)
/* Process the normal ELF symbol table first. */
- elf_symtab_read (abfd, addr, mainline, sf->objfile);
+ elf_symtab_read (abfd, addr, mainline, objfile);
/* Now process the DWARF debugging information, which is contained in
special ELF sections. We first have to find them... */
@@ -298,7 +301,7 @@ elf_symfile_read (sf, addr, mainline)
bfd_get_filename (abfd),
addr, mainline,
ei.dboffset, ei.dbsize,
- ei.lnoffset, ei.lnsize, sf->objfile);
+ ei.lnoffset, ei.lnsize, objfile);
}
if (!have_partial_symbols ())
@@ -311,7 +314,7 @@ elf_symfile_read (sf, addr, mainline)
/* Install any minimal symbols that have been collected as the current
minimal symbols for this objfile. */
- install_minimal_symbols (sf -> objfile);
+ install_minimal_symbols (objfile);
do_cleanups (back_to);
}
@@ -324,8 +327,25 @@ elf_symfile_read (sf, addr, mainline)
just a stub. */
static void
-elf_new_init ()
+elf_new_init (objfile)
+ struct objfile *objfile;
+{
+ buildsym_new_init ();
+}
+
+/* Perform any local cleanups required when we are done with a particular
+ objfile. I.E, we are in the process of discarding all symbol information
+ for an objfile, freeing up all memory held for it, and unlinking the
+ objfile struct from the global list of known objfiles. */
+
+static void
+elf_symfile_finish (objfile)
+ struct objfile *objfile;
{
+ if (objfile -> sym_private != NULL)
+ {
+ mfree (objfile -> md, objfile -> sym_private);
+ }
}
/* ELF specific initialization routine for reading symbols.
@@ -338,8 +358,8 @@ elf_new_init ()
just a stub. */
static void
-elf_symfile_init (sf)
- struct sym_fns *sf;
+elf_symfile_init (objfile)
+ struct objfile *objfile;
{
}
@@ -360,14 +380,14 @@ elf_symfile_init (sf)
use "elf" in the same sense as "a.out" or "coff", to imply both the ELF
object file format and the DWARF debugging format. */
-static struct sym_fns elf_sym_fns = {
+static struct sym_fns elf_sym_fns =
+{
"elf", /* sym_name: name or name prefix of BFD target type */
3, /* sym_namelen: number of significant sym_name chars */
elf_new_init, /* sym_new_init: init anything gbl to entire symtab */
elf_symfile_init, /* sym_init: read initial info, setup for sym_read() */
elf_symfile_read, /* sym_read: read a symbol file into symtab */
- NULL, /* sym_bfd: accessor for symbol file being read */
- NULL, /* sym_private: sym_init & sym_read shared info */
+ elf_symfile_finish, /* sym_finish: finished with file, cleanup */
NULL /* next: pointer to next struct sym_fns */
};