public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] Move core_bfd to program space
Date: Thu, 03 May 2018 16:22:00 -0000	[thread overview]
Message-ID: <20180503162234.15371-2-palves@redhat.com> (raw)
In-Reply-To: <20180503162234.15371-1-palves@redhat.com>

From: Tom Tromey <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 is a basic transformation for multi-target work.

yyyy-mm-dd  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/corefile.c  | 4 ----
 gdb/gdbcore.h   | 2 +-
 gdb/progspace.h | 3 +++
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/corefile.c b/gdb/corefile.c
index 114de83640..e0c7540140 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -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.  */
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 401c213d48..d06ccc3507 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -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.  */
 
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 67c0a240da..835fcfdd5d 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -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
-- 
2.14.3

  reply	other threads:[~2018-05-03 16:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 16:22 [PATCH 0/3] Torward multiple simultaneous core instances Pedro Alves
2018-05-03 16:22 ` Pedro Alves [this message]
2018-05-04 15:41   ` [PATCH 1/3] Move core_bfd to program space Tom Tromey
2018-05-04 16:09     ` Pedro Alves
2018-05-04 16:46       ` Tom Tromey
2018-05-03 16:22 ` [PATCH 2/3] Eliminate the 'the_core_target' global Pedro Alves
2018-05-04 15:59   ` Tom Tromey
2018-05-03 16:22 ` [PATCH 3/3] Heap-allocate core_target instances Pedro Alves
2018-05-04 16:36   ` Tom Tromey
2018-05-06 15:38     ` Pedro Alves
2018-05-07 14:26       ` Tom Tromey
2018-05-11 19:40         ` Pedro Alves

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=20180503162234.15371-2-palves@redhat.com \
    --to=palves@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).