* readelf.c (dump_section): Don't print 32-bit values, which
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 459709adf44d4c8e12491f958a988117576a12f4..a3af5a41f143977447e3f66182f933418c3c029b 100644 (file)
@@ -34,6 +34,9 @@
 #include "target.h"
 #include "bcache.h"
 #include "mdebugread.h"
+#include "expression.h"
+#include "parser-defs.h"
+
 #include "gdb_assert.h"
 #include <sys/types.h>
 #include "gdb_stat.h"
@@ -45,6 +48,7 @@
 #include "breakpoint.h"
 #include "block.h"
 #include "dictionary.h"
+#include "source.h"
 
 /* Prototypes for local functions */
 
@@ -392,6 +396,10 @@ free_objfile (struct objfile *objfile)
       objfile->separate_debug_objfile_backlink->separate_debug_objfile = NULL;
     }
   
+  /* Remove any references to this objfile in the global value
+     lists.  */
+  preserve_values (objfile);
+
   /* First do any symbol file specific actions required when we are
      finished with a particular symbol file.  Note that if the objfile
      is using reusable symbol information (via mmalloc) then each of
@@ -432,10 +440,30 @@ free_objfile (struct objfile *objfile)
      is unknown, but we play it safe for now and keep each action until
      it is shown to be no longer needed. */
 
-  /* I *think* all our callers call clear_symtab_users.  If so, no need
-     to call this here.  */
+  /* Not all our callers call clear_symtab_users (objfile_purge_solibs,
+     for example), so we need to call this here.  */
   clear_pc_function_cache ();
 
+  /* Clear globals which might have pointed into a removed objfile.
+     FIXME: It's not clear which of these are supposed to persist
+     between expressions and which ought to be reset each time.  */
+  expression_context_block = NULL;
+  innermost_block = NULL;
+
+  /* Check to see if the current_source_symtab belongs to this objfile,
+     and if so, call clear_current_source_symtab_and_line. */
+
+  {
+    struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+    struct symtab *s;
+
+    ALL_OBJFILE_SYMTABS (objfile, s)
+      {
+       if (s == cursal.symtab)
+         clear_current_source_symtab_and_line ();
+      }
+  }
+
   /* The last thing we do is free the objfile struct itself. */
 
   objfile_free_data (objfile);
This page took 0.024015 seconds and 4 git commands to generate.