Move core_bfd to program space
authorTom Tromey <tromey@redhat.com>
Fri, 11 May 2018 18:10:13 +0000 (19:10 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 11 May 2018 18:10:13 +0000 (19:10 +0100)
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 is a basic transformation for multi-target work.

2018-05-11  Tom Tromey  <tromey@redhat.com>
    Pedro Alves  <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
gdb/corefile.c
gdb/gdbcore.h
gdb/progspace.h

index 34d2d497d2c06f4723990d2f15e4899be3f8758e..97ee0f926e9bfd3f6e89d6db73d74441ce8cb6c4 100644 (file)
@@ -1,3 +1,10 @@
+2018-05-11  Tom Tromey  <tromey@redhat.com>
+           Pedro Alves  <tromey@redhat.com>
+
+       * corefile.c (core_bfd): Remove.
+       * gdbcore.h (core_bfd): Now a macro.
+       * progspace.h (struct program_space) <cbfd>: New field.
+
 2018-05-11  Tom Tromey  <tom@tromey.com>
 
        * mdebugread.c (parse_partial_symbols, psymtab_to_symtab_1): Use
index 114de836403c4c0e60d7f2d56c019100be1570b7..e0c75401402001121567284641e1bd5d3fb27940 100644 (file)
@@ -49,10 +49,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;
-
 \f
 
 /* Backward compatability with old way of specifying core files.  */
index 401c213d4824ec6c22c4dd6c3a5ca31a3b0a4ebf..d06ccc3507e60bc586e44c1020a559de42841534 100644 (file)
@@ -133,7 +133,7 @@ extern void specify_exec_file_hook (void (*hook) (const char *filename));
 
 /* Binary File Diddler for the core file.  */
 
-extern bfd *core_bfd;
+#define core_bfd (current_program_space->cbfd)
 
 /* corelow.c target.  It is never NULL after GDB initialization.  */
 
index 67c0a240dadcef0244441081daabd178d0c84802..835fcfdd5d553504fb2fdccdd22662e03e637d8d 100644 (file)
@@ -157,6 +157,9 @@ struct program_space
      It needs to be freed by xfree.  It is not NULL iff EBFD is not NULL.  */
   char *pspace_exec_filename = NULL;
 
+  /* Binary file diddling handle for the core file.  */
+  bfd *cbfd = NULL;
+
   /* The address space attached to this program space.  More than one
      program space may be bound to the same address space.  In the
      traditional unix-like debugging scenario, this will usually
This page took 0.029795 seconds and 4 git commands to generate.