gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 23 Jun 2009 18:19:54 +0000 (18:19 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 23 Jun 2009 18:19:54 +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 80e32c38af5034e5fc74ec982d9c084239e90cff..b02d5ae01b3cb04a0c8069c33573cc7e8e6dd2b0 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 968c8a85a17ab6ba50a86dc809d493e3b121b5a8..25f3f26bc1db6dabf49e9b7245d436e396d55b38 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 ();