*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / gcore.c
index aedda412eb6771adccb86983cdb977a4c3ccd748..f9a138995d47942a142c4eb41670295dc2cc7306 100644 (file)
@@ -33,6 +33,7 @@
 #include <fcntl.h>
 #include "regcache.h"
 #include "regset.h"
+#include "gdb_bfd.h"
 
 /* The largest amount of memory to read from the target at once.  We
    must throttle it to limit the amount of memory used by GDB during
@@ -50,10 +51,11 @@ static int gcore_memory_sections (bfd *);
 bfd *
 create_gcore_bfd (char *filename)
 {
-  bfd *obfd = bfd_openw (filename, default_gcore_target ());
+  bfd *obfd = gdb_bfd_ref (bfd_openw (filename, default_gcore_target ()));
 
   if (!obfd)
     error (_("Failed to open '%s' for output."), filename);
+  gdb_bfd_stash_filename (obfd);
   bfd_set_format (obfd, bfd_core);
   bfd_set_arch_mach (obfd, default_gcore_arch (), default_gcore_mach ());
   return obfd;
@@ -110,7 +112,7 @@ do_bfd_delete_cleanup (void *arg)
   bfd *obfd = arg;
   const char *filename = obfd->filename;
 
-  bfd_close (arg);
+  gdb_bfd_unref (arg);
   unlink (filename);
 }
 
@@ -154,7 +156,7 @@ gcore_command (char *args, int from_tty)
   fprintf_filtered (gdb_stdout, "Saved corefile %s\n", corefilename);
 
   discard_cleanups (old_chain);
-  bfd_close (obfd);
+  gdb_bfd_unref (obfd);
 }
 
 static unsigned long
This page took 0.023654 seconds and 4 git commands to generate.