From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102759 invoked by alias); 3 May 2018 16:22:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 102709 invoked by uid 89); 3 May 2018 16:22:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=freed, U*tromey X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 May 2018 16:22:37 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF9514025F15 for ; Thu, 3 May 2018 16:22:35 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id A169311166E0 for ; Thu, 3 May 2018 16:22:35 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 1/3] Move core_bfd to program space Date: Thu, 03 May 2018 16:22:00 -0000 Message-Id: <20180503162234.15371-2-palves@redhat.com> In-Reply-To: <20180503162234.15371-1-palves@redhat.com> References: <20180503162234.15371-1-palves@redhat.com> X-SW-Source: 2018-05/txt/msg00050.txt.bz2 From: Tom Tromey 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 Pedro Alves * corefile.c (core_bfd): Remove. * gdbcore.h (core_bfd): Now a macro. * progspace.h (struct program_space) : 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; - /* 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