From patchwork Fri Jul 18 19:27:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 2113 Received: (qmail 28643 invoked by alias); 18 Jul 2014 19:27:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 28588 invoked by uid 89); 18 Jul 2014 19:27:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Jul 2014 19:27:20 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6IJRIbb020414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 18 Jul 2014 15:27:18 -0400 Received: from barimba.redhat.com (ovpn-113-27.phx2.redhat.com [10.3.113.27]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6IJRHft019114; Fri, 18 Jul 2014 15:27:18 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/4] move core_bfd to program space Date: Fri, 18 Jul 2014 13:27:12 -0600 Message-Id: <1405711635-1102-2-git-send-email-tromey@redhat.com> In-Reply-To: <1405711635-1102-1-git-send-email-tromey@redhat.com> References: <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 * corefile.c (core_bfd): Remove. * gdbcore.h (core_bfd): Now a macro. * progspace.h (struct program_space) : 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; };