Revert call to bfd_cache_close().
[deliverable/binutils-gdb.git] / gdb / corefile.c
index 5c816b125e772873d07515c988983f54fe82613f..846208ed1cd086423f84fe6440a094dac7a3790b 100644 (file)
@@ -1,5 +1,6 @@
 /* Core dump and executable file functions above target vector, for GDB.
-   Copyright 1986, 1987, 1989, 1991-1994, 2000
+   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
+   1999, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -24,7 +25,6 @@
 #include <errno.h>
 #include <signal.h>
 #include <fcntl.h>
-#include "frame.h"             /* required by inferior.h */
 #include "inferior.h"
 #include "symtab.h"
 #include "command.h"
 #include "target.h"
 #include "gdbcore.h"
 #include "dis-asm.h"
-#include "language.h"
 #include "gdb_stat.h"
-#include "symfile.h"
-#include "objfiles.h"
 
 /* Local function declarations.  */
 
@@ -72,35 +69,13 @@ core_file_command (char *filename, int from_tty)
   dont_repeat ();              /* Either way, seems bogus. */
 
   t = find_core_target ();
-  if (t != NULL)
-    if (!filename)
-      (t->to_detach) (filename, from_tty);
-    else
-      {
-       /* Yes, we were given the path of a core file.  Do we already
-          have a symbol file?  If not, can we determine it from the
-          core file?  If we can, do so.
-        */
-#ifdef HPUXHPPA
-       if (symfile_objfile == NULL)
-         {
-           char *symfile;
-           symfile = t->to_core_file_to_sym_file (filename);
-           if (symfile)
-             {
-               char *symfile_copy = xstrdup (symfile);
-
-               make_cleanup (free, symfile_copy);
-               symbol_file_command (symfile_copy, from_tty);
-             }
-           else
-             warning ("Unknown symbols for '%s'; use the 'symbol-file' command.", filename);
-         }
-#endif
-       (t->to_open) (filename, from_tty);
-      }
-  else
+  if (t == NULL)
     error ("GDB can't read core files on this machine.");
+
+  if (!filename)
+    (t->to_detach) (filename, from_tty);
+  else
+    (t->to_open) (filename, from_tty);
 }
 \f
 
@@ -182,12 +157,14 @@ reopen_exec_file (void)
 
   /* If the timestamp of the exec file has changed, reopen it. */
   filename = xstrdup (bfd_get_filename (exec_bfd));
-  make_cleanup (free, filename);
+  make_cleanup (xfree, filename);
   mtime = bfd_get_mtime (exec_bfd);
   res = stat (filename, &st);
 
   if (mtime && mtime != st.st_mtime)
-    exec_file_command (filename, 0);
+    {
+      exec_open (filename, 0);
+    }
 #endif
 }
 \f
@@ -396,7 +373,7 @@ void
 set_gnutarget (char *newtarget)
 {
   if (gnutarget_string != NULL)
-    free (gnutarget_string);
+    xfree (gnutarget_string);
   gnutarget_string = savestring (newtarget, strlen (newtarget));
   set_gnutarget_command (NULL, 0, NULL);
 }
This page took 0.025048 seconds and 4 git commands to generate.