OSDN Git Service

gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 23 Jun 2009 18:19:53 +0000 (18:19 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 23 Jun 2009 18:19:53 +0000 (18:19 +0000)
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
gdb/symfile.c

index 80e32c3..b02d5ae 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       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  <uweigand@de.ibm.com>
 
        * jv-lang.h (JAVA_OBJECT_SIZE): Remove.
index 968c8a8..25f3f26 100644 (file)
@@ -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 ();