Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH 1/4] move core_bfd to program space
Date: Fri, 18 Jul 2014 19:27:00 -0000	[thread overview]
Message-ID: <1405711635-1102-2-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1405711635-1102-1-git-send-email-tromey@redhat.com>

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 --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;
   };
-- 
1.9.3


  reply	other threads:[~2014-07-18 19:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 19:27 [PATCH 0/4] baby step toward multi-target Tom Tromey
2014-07-18 19:27 ` Tom Tromey [this message]
2014-07-18 19:27 ` [PATCH 2/4] simplify target_is_pushed Tom Tromey
2014-07-29 13:22   ` Joel Brobecker
2014-07-29 15:16     ` Tom Tromey
2014-07-18 19:45 ` [PATCH 3/4] add to_identity Tom Tromey
2014-07-29 14:56   ` Joel Brobecker
2014-07-29 15:11     ` Tom Tromey
2014-07-18 20:44 ` [PATCH 4/4] convert corelow to to_xclose Tom Tromey
2014-07-29 15:11 ` [PATCH 0/4] baby step toward multi-target Pedro Alves
2014-07-29 15:15   ` Tom Tromey
2014-07-29 16:32     ` Pedro Alves
2014-07-29 19:04       ` Tom Tromey
2014-07-29 21:32         ` Doug Evans
2014-08-11  5:54           ` Doug Evans
2014-07-29 15:40   ` Doug Evans
2014-08-10 20:02 ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405711635-1102-2-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox