#include "filenames.h"
#include "progspace.h"
#include "objfiles.h"
+#include "gdb_bfd.h"
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
core_data = NULL;
}
- name = bfd_get_filename (core_bfd);
- gdb_bfd_close_or_warn (core_bfd);
- xfree (name);
+ gdb_bfd_unref (core_bfd);
core_bfd = NULL;
}
core_vec = NULL;
if (scratch_chan < 0)
perror_with_name (filename);
- temp_bfd = bfd_fopen (filename, gnutarget,
- write_files ? FOPEN_RUB : FOPEN_RB,
- scratch_chan);
+ temp_bfd = gdb_bfd_fopen (filename, gnutarget,
+ write_files ? FOPEN_RUB : FOPEN_RB,
+ scratch_chan);
if (temp_bfd == NULL)
perror_with_name (filename);
/* FIXME: should be checking for errors from bfd_close (for one
thing, on error it does not free all the storage associated
with the bfd). */
- make_cleanup_bfd_close (temp_bfd);
+ make_cleanup_bfd_unref (temp_bfd);
error (_("\"%s\" is not a core dump: %s"),
filename, bfd_errmsg (bfd_get_error ()));
}
/* Looks semi-reasonable. Toss the old core file and work on the
new. */
- discard_cleanups (old_chain); /* Don't free filename any more */
+ do_cleanups (old_chain);
unpush_target (&core_ops);
core_bfd = temp_bfd;
old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/);