summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2003-02-20 18:31:14 +0000
committerDaniel Jacobowitz <drow@false.org>2003-02-20 18:31:14 +0000
commit7134143f534f02e8a283bb1fc0a9f22300c90e8d (patch)
tree7df28797a4403c1f540ca84d0a1d3214ab06058e
parentcf466558d0faa40bd6cc78b7f4e983c5a3ec883b (diff)
downloadbinutils-gdb-7134143f534f02e8a283bb1fc0a9f22300c90e8d.tar.gz
* coffread.c (coff_symfile_read): Clean up minimal symbols earlier.
* dbxread.c (elfstab_build_psymtabs): Don't call install_minimal_symbols. (stabsect_build_psymtabs): Likewise. * elfread.c (elf_symfile_read): Call install_minimal_symbols earlier. * somread.c (som_symfile_read): Call install_minimal_symbols and do_cleanups earlier. * nlmread.c (nlm_symfile_read): Likewise. * mdebugread.c (elfmdebug_build_psymtabs): Call install_minimal_symbols and make appropriate cleanups.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/coffread.c7
-rw-r--r--gdb/dbxread.c7
-rw-r--r--gdb/elfread.c16
-rw-r--r--gdb/mdebugread.c11
-rw-r--r--gdb/nlmread.c13
-rw-r--r--gdb/somread.c16
7 files changed, 57 insertions, 27 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9e9a3875a71..226024c0d3f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2002-02-20 Daniel Jacobowitz <drow@mvista.com>
+
+ * coffread.c (coff_symfile_read): Clean up minimal symbols earlier.
+ * dbxread.c (elfstab_build_psymtabs): Don't call
+ install_minimal_symbols.
+ (stabsect_build_psymtabs): Likewise.
+ * elfread.c (elf_symfile_read): Call install_minimal_symbols
+ earlier.
+ * somread.c (som_symfile_read): Call install_minimal_symbols
+ and do_cleanups earlier.
+ * nlmread.c (nlm_symfile_read): Likewise.
+ * mdebugread.c (elfmdebug_build_psymtabs): Call
+ install_minimal_symbols and make appropriate cleanups.
+
2003-02-20 Kevin Buettner <kevinb@redhat.com>
* solib.c (reload_shared_libraries): New function.
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 912943ccd83..db41896b6d7 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -518,7 +518,7 @@ coff_symfile_read (struct objfile *objfile, int mainline)
unsigned int num_symbols;
int symtab_offset;
int stringtab_offset;
- struct cleanup *back_to;
+ struct cleanup *back_to, *cleanup_minimal_symbols;
int stabstrsize;
int len;
char * target;
@@ -598,7 +598,7 @@ coff_symfile_read (struct objfile *objfile, int mainline)
error ("\"%s\": can't get string table", name);
init_minimal_symbol_collection ();
- make_cleanup_discard_minimal_symbols ();
+ cleanup_minimal_symbols = make_cleanup_discard_minimal_symbols ();
/* Now that the executable file is positioned at symbol table,
process it and define symbols accordingly. */
@@ -619,6 +619,9 @@ coff_symfile_read (struct objfile *objfile, int mainline)
install_minimal_symbols (objfile);
+ /* Free the installed minimal symbol data. */
+ do_cleanups (cleanup_minimal_symbols);
+
bfd_map_over_sections (abfd, coff_locate_sections, (void *) info);
if (info->stabsects)
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 4d9f35d8587..6c90f140111 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -3556,7 +3556,6 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline,
buildsym_new_init ();
free_header_files ();
init_header_files ();
- install_minimal_symbols (objfile);
processing_acc_compilation = 1;
@@ -3568,7 +3567,10 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline,
/* In an elf file, we've already installed the minimal symbols that came
from the elf (non-stab) symbol table, so always act like an
- incremental load here. */
+ incremental load here. dbx_symfile_read should not generate any new
+ minimal symbols, since we will have already read the ELF dynamic symbol
+ table and normal symbol entries won't be in the ".stab" section; but in
+ case it does, it will install them itself. */
dbx_symfile_read (objfile, 0);
if (back_to)
@@ -3650,7 +3652,6 @@ stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name,
buildsym_new_init ();
free_header_files ();
init_header_files ();
- install_minimal_symbols (objfile);
/* Now, do an incremental load */
diff --git a/gdb/elfread.c b/gdb/elfread.c
index b96d6e7ff28..7aee37cc5db 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -542,6 +542,15 @@ elf_symfile_read (struct objfile *objfile, int mainline)
elf_symtab_read (objfile, 1);
+ /* Install any minimal symbols that have been collected as the current
+ minimal symbols for this objfile. The debug readers below this point
+ should not generate new minimal symbols; if they do it's their
+ responsibility to install them. "mdebug" appears to be the only one
+ which will do this. */
+
+ install_minimal_symbols (objfile);
+ do_cleanups (back_to);
+
/* Now process debugging information, which is contained in
special ELF sections. */
@@ -611,13 +620,6 @@ elf_symfile_read (struct objfile *objfile, int mainline)
if (DWARF2_BUILD_FRAME_INFO_P ())
DWARF2_BUILD_FRAME_INFO(objfile);
-
- /* Install any minimal symbols that have been collected as the current
- minimal symbols for this objfile. */
-
- install_minimal_symbols (objfile);
-
- do_cleanups (back_to);
}
/* This cleans up the objfile's sym_stab_info pointer, and the chain of
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ac49ca0fafd..51536d71cc6 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4809,6 +4809,14 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
{
bfd *abfd = objfile->obfd;
struct ecoff_debug_info *info;
+ struct cleanup *back_to;
+
+ /* FIXME: It's not clear whether we should be getting minimal symbol
+ information from .mdebug in an ELF file, or whether we will.
+ Re-initialize the minimal symbol reader in case we do. */
+
+ init_minimal_symbol_collection ();
+ back_to = make_cleanup_discard_minimal_symbols ();
info = ((struct ecoff_debug_info *)
obstack_alloc (&objfile->psymbol_obstack,
@@ -4819,6 +4827,9 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
bfd_errmsg (bfd_get_error ()));
mdebug_build_psymtabs (objfile, swap, info);
+
+ install_minimal_symbols (objfile);
+ do_cleanups (back_to);
}
diff --git a/gdb/nlmread.c b/gdb/nlmread.c
index 089c0f7dfb5..10af4c5c88c 100644
--- a/gdb/nlmread.c
+++ b/gdb/nlmread.c
@@ -191,6 +191,12 @@ nlm_symfile_read (struct objfile *objfile, int mainline)
nlm_symtab_read (abfd, offset, objfile);
+ /* Install any minimal symbols that have been collected as the current
+ minimal symbols for this objfile. */
+
+ install_minimal_symbols (objfile);
+ do_cleanups (back_to);
+
stabsect_build_psymtabs (objfile, mainline, ".stab",
".stabstr", ".text");
@@ -205,13 +211,6 @@ nlm_symfile_read (struct objfile *objfile, int mainline)
/* FIXME: We could locate and read the optional native debugging format
here and add the symbols to the minimal symbol table. */
-
- /* Install any minimal symbols that have been collected as the current
- minimal symbols for this objfile. */
-
- install_minimal_symbols (objfile);
-
- do_cleanups (back_to);
}
diff --git a/gdb/somread.c b/gdb/somread.c
index 6ba95a65b94..85d4f0a537c 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -353,6 +353,14 @@ som_symfile_read (struct objfile *objfile, int mainline)
som_symtab_read (abfd, objfile, objfile->section_offsets);
+ /* Install any minimal symbols that have been collected as the current
+ minimal symbols for this objfile.
+ Further symbol-reading is done incrementally, file-by-file,
+ in a step known as "psymtab-to-symtab" expansion. hp-symtab-read.c
+ contains the code to do the actual DNTT scanning and symtab building. */
+ install_minimal_symbols (objfile);
+ do_cleanups (back_to);
+
/* Now read information from the stabs debug sections.
This is a no-op for SOM.
Perhaps it is intended for some kind of mixed STABS/SOM
@@ -366,16 +374,8 @@ som_symfile_read (struct objfile *objfile, int mainline)
together with a scan of the GNTT. See hp-psymtab-read.c. */
hpread_build_psymtabs (objfile, mainline);
- /* Install any minimal symbols that have been collected as the current
- minimal symbols for this objfile.
- Further symbol-reading is done incrementally, file-by-file,
- in a step known as "psymtab-to-symtab" expansion. hp-symtab-read.c
- contains the code to do the actual DNTT scanning and symtab building. */
- install_minimal_symbols (objfile);
-
/* Force hppa-tdep.c to re-read the unwind descriptors. */
objfile->obj_private = NULL;
- do_cleanups (back_to);
}
/* Initialize anything that needs initializing when a completely new symbol