Index: gdb/bfd-target.c |
diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c |
index 6728800461e5707009fd53319b3caebc75da6b7b..8d09831c8182f9d51edccd78506e1f84713869c1 100644 |
--- a/gdb/bfd-target.c |
+++ b/gdb/bfd-target.c |
@@ -1,6 +1,6 @@ |
/* Very simple "bfd" target, for GDB, the GNU debugger. |
- Copyright (C) 2003, 2005, 2007-2012 Free Software Foundation, Inc. |
+ Copyright (C) 2003-2013 Free Software Foundation, Inc. |
This file is part of GDB. |
@@ -21,6 +21,7 @@ |
#include "target.h" |
#include "bfd-target.h" |
#include "exec.h" |
+#include "gdb_bfd.h" |
/* The object that is stored in the target_ops->to_data field has this |
type. */ |
@@ -66,11 +67,11 @@ target_bfd_get_section_table (struct target_ops *ops) |
} |
static void |
-target_bfd_xclose (struct target_ops *t, int quitting) |
+target_bfd_xclose (struct target_ops *t) |
{ |
struct target_bfd_data *data = t->to_data; |
- bfd_close (data->bfd); |
+ gdb_bfd_unref (data->bfd); |
xfree (data->table.sections); |
xfree (data); |
xfree (t); |
@@ -84,6 +85,7 @@ target_bfd_reopen (struct bfd *abfd) |
data = XZALLOC (struct target_bfd_data); |
data->bfd = abfd; |
+ gdb_bfd_ref (abfd); |
build_section_table (abfd, &data->table.sections, &data->table.sections_end); |
t = XZALLOC (struct target_ops); |
@@ -94,6 +96,7 @@ target_bfd_reopen (struct bfd *abfd) |
t->to_xfer_partial = target_bfd_xfer_partial; |
t->to_xclose = target_bfd_xclose; |
t->to_data = data; |
+ t->to_magic = OPS_MAGIC; |
return t; |
} |