/* SPU native-dependent code for GDB, the GNU debugger.
- Copyright (C) 2006-2012 Free Software Foundation, Inc.
+ Copyright (C) 2006-2013 Free Software Foundation, Inc.
Contributed by Ulrich Weigand <uweigand@de.ibm.com>.
#include "symfile.h"
#include "gdb_wait.h"
#include "gdbthread.h"
+#include "gdb_bfd.h"
#include <sys/ptrace.h>
#include <asm/ptrace.h>
static int
parse_spufs_run (int *fd, ULONGEST *addr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte buf[4];
ULONGEST pc = fetch_ppc_register (32); /* nip */
/* Open BFD representing SPE executable and read its symbols. */
nbfd = spu_bfd_open (addr);
if (nbfd)
- symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE,
- NULL, 0, NULL);
+ {
+ struct cleanup *cleanup = make_cleanup_bfd_unref (nbfd);
+
+ symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE,
+ NULL, 0, NULL);
+ do_cleanups (cleanup);
+ }
}