aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-12-19 22:20:07 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-12-19 22:20:07 +0000
commitf6eeced03db615a949de8d43c4e4402209a7bada (patch)
tree5edfb5fb447ebee708093bad729511bc711d15b9 /gdb/symfile.c
parent8de7d199bbcce5fffad187294a57106ad82af16b (diff)
downloadgdb-f6eeced03db615a949de8d43c4e4402209a7bada.zip
gdb-f6eeced03db615a949de8d43c4e4402209a7bada.tar.gz
gdb-f6eeced03db615a949de8d43c4e4402209a7bada.tar.bz2
gdb/
* symfile.c (reread_symbols): Move free_objfile_separate_debug, preserve_values, sym_finish and clear_objfile_data calls before BFD close. Move free_objfile_separate_debug as the very first call. New comment on the ordering. gdb/testsuite/ * gdb.base/reread.exp: If srcfile2 fails to build retry it with -DNO_SECTIONS. * gdb.base/reread2.c <!NO_SECTIONS>: New sections block.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 72080ac..e9c290c 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2446,6 +2446,29 @@ reread_symbols (void)
exec_file_attach (bfd_get_filename (objfile->obfd), 0);
}
+ /* Keep the calls order approx. the same as in free_objfile. */
+
+ /* Free the separate debug objfiles. It will be
+ automatically recreated by sym_read. */
+ free_objfile_separate_debug (objfile);
+
+ /* Remove any references to this objfile in the global
+ value lists. */
+ preserve_values (objfile);
+
+ /* Nuke all the state that we will re-read. Much of the following
+ code which sets things to NULL really is necessary to tell
+ other parts of GDB that there is nothing currently there.
+
+ Try to keep the freeing order compatible with free_objfile. */
+
+ if (objfile->sf != NULL)
+ {
+ (*objfile->sf->sym_finish) (objfile);
+ }
+
+ clear_objfile_data (objfile);
+
/* Clean up any state BFD has sitting around. We don't need
to close the descriptor but BFD lacks a way of closing the
BFD without closing the descriptor. */
@@ -2471,27 +2494,6 @@ reread_symbols (void)
memcpy (offsets, objfile->section_offsets,
SIZEOF_N_SECTION_OFFSETS (num_offsets));
- /* Remove any references to this objfile in the global
- value lists. */
- preserve_values (objfile);
-
- /* Nuke all the state that we will re-read. Much of the following
- code which sets things to NULL really is necessary to tell
- other parts of GDB that there is nothing currently there.
-
- Try to keep the freeing order compatible with free_objfile. */
-
- if (objfile->sf != NULL)
- {
- (*objfile->sf->sym_finish) (objfile);
- }
-
- clear_objfile_data (objfile);
-
- /* Free the separate debug objfiles. It will be
- automatically recreated by sym_read. */
- free_objfile_separate_debug (objfile);
-
/* FIXME: Do we have to free a whole linked list, or is this
enough? */
if (objfile->global_psymbols.list)