From 5b2ab4610e175ef90edff7754e1121816b3eb5ad Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 23 Jun 2009 18:19:54 +0000 Subject: [PATCH] gdb/ Fix a regression by the mmap patch from 2009-06-16. * symfile.c (reread_symbols): Move sym_finish and clear_objfile_data calls before deleting the OBJFILE obstack. Extend the comment. --- gdb/ChangeLog | 6 ++++++ gdb/symfile.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 80e32c38af5..b02d5ae01b3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-06-23 Jan Kratochvil + + Fix a regression by the mmap patch from 2009-06-16. + * symfile.c (reread_symbols): Move sym_finish and clear_objfile_data + calls before deleting the OBJFILE obstack. Extend the comment. + 2009-06-23 Ulrich Weigand * jv-lang.h (JAVA_OBJECT_SIZE): Remove. diff --git a/gdb/symfile.c b/gdb/symfile.c index 968c8a85a17..25f3f26bc1d 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2334,7 +2334,16 @@ reread_symbols (void) /* 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. */ + 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); /* FIXME: Do we have to free a whole linked list, or is this enough? */ @@ -2371,11 +2380,6 @@ reread_symbols (void) sizeof (objfile->msymbol_hash)); memset (&objfile->msymbol_demangled_hash, 0, sizeof (objfile->msymbol_demangled_hash)); - clear_objfile_data (objfile); - if (objfile->sf != NULL) - { - (*objfile->sf->sym_finish) (objfile); - } objfile->psymbol_cache = bcache_xmalloc (); objfile->macro_cache = bcache_xmalloc (); -- 2.30.2