diff mbox

[1/4] move core_bfd to program space

Message ID 1405711635-1102-2-git-send-email-tromey@redhat.com
State New
Headers show

Commit Message

Tom Tromey July 18, 2014, 7:27 p.m. UTC
This moves the core_bfd global to be a field of the program space.  It
then replaces core_bfd with a macro to avoid a massive patch -- the
same approach taken for various other program space fields.

This patch is a basic transformation for eventual multi-target work.

2014-07-18  Tom Tromey  <tromey@redhat.com>

	* corefile.c (core_bfd): Remove.
	* gdbcore.h (core_bfd): Now a macro.
	* progspace.h (struct program_space) <cbfd>: New field.
---
 gdb/ChangeLog   | 6 ++++++
 gdb/corefile.c  | 4 ----
 gdb/gdbcore.h   | 2 +-
 gdb/progspace.h | 3 +++
 4 files changed, 10 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/gdb/corefile.c b/gdb/corefile.c
index 8a96d75..6b62e13 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -57,10 +57,6 @@  static hook_type *exec_file_extra_hooks;	/* Array of additional
 						   hooks.  */
 static int exec_file_hook_count = 0;		/* Size of array.  */
 
-/* Binary file diddling handle for the core file.  */
-
-bfd *core_bfd = NULL;
-
 /* corelow.c target.  It is never NULL after GDB initialization.  */
 
 struct target_ops *core_target;
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 3f81791..c48067e 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -138,7 +138,7 @@  extern void specify_exec_file_hook (void (*hook) (char *filename));
 
 /* Binary File Diddler for the core file.  */
 
-extern bfd *core_bfd;
+#define core_bfd (current_program_space->cbfd)
 
 extern struct target_ops *core_target;
 
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 08e04eb..852d38a 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -206,6 +206,9 @@  struct program_space
        This is so we can properly report solib changes to the user.  */
     VEC (char_ptr) *deleted_solibs;
 
+    /* Binary file diddling handle for the core file.  */
+    bfd *cbfd;
+
     /* Per pspace data-pointers required by other GDB modules.  */
     REGISTRY_FIELDS;
   };