From patchwork Mon Apr 28 09:49:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 704 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 4D4A336007C for ; Mon, 28 Apr 2014 02:50:02 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id EF3B95006219; Mon, 28 Apr 2014 02:50:01 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id D4DA35006227 for ; Mon, 28 Apr 2014 02:50:01 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=vy9mw NNtspEfHd+7muSHrheV/KXJohbVW5hUH6SMXK4Zf0e9DH0zv5wkc2rGw1OPQO/BO nFuVEo07Aq8WjLEHqTsnc77myxyN1878Plh8F0wK2TNisFBHWWML27KJgW/8N0gt GISeJVooRGmY3sULTaa95XWLF8yQf8v0tEQjBE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=BxBVRMMsY1/ ZlRWibVILBBk0/pk=; b=KMMtTIyAOIGKIkqd1GWIY1QqMVdcbvIzzUwQFy550jB +BLPNIQaeIROATg3z98p7KQO7GWHwB82YwUPy978Z0MyWel96gW8MqYsCUZuB0FP gm4xy1KpbmIheoPkjZsKkuqhukYy40EdcwgXr6ZkK9vLejMJCHbbj6YcqQp9zS/I = Received: (qmail 32632 invoked by alias); 28 Apr 2014 09:50:00 -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 32621 invoked by uid 89); 28 Apr 2014 09:49:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp17.uk.ibm.com Received: from e06smtp17.uk.ibm.com (HELO e06smtp17.uk.ibm.com) (195.75.94.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 28 Apr 2014 09:49:58 +0000 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Apr 2014 10:49:55 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 28 Apr 2014 10:49:53 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 14B802190046 for ; Mon, 28 Apr 2014 10:49:45 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s3S9nqa4852412 for ; Mon, 28 Apr 2014 09:49:52 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s3S9nqv2026279 for ; Mon, 28 Apr 2014 03:49:52 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-188.boeblingen.de.ibm.com [9.152.212.188]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s3S9npS8026235; Mon, 28 Apr 2014 03:49:51 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Qinwei Subject: [RFC 08/23] SCORE: Replace regset_alloc() invocation by a static regset structure References: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> Date: Mon, 28 Apr 2014 11:49:51 +0200 In-Reply-To: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> (Andreas Arnez's message of "Mon, 28 Apr 2014 11:35:33 +0200") Message-ID: <87d2g14wcg.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042809-0542-0000-0000-000008CC620A X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in Since this changes makes the only member of the tdep structure obsolete, the tdep structure is removed. gdb/ * score-tdep.c (score7_linux_gregset): New static regset structure. (score7_linux_regset_from_core_section): Remove dynamic regset allocation. (score_gdbarch_init): Drop allocation of tdep structure. * score-tdep.h (struct gdbarch_tdep): Remove declaration. --- gdb/score-tdep.c | 21 ++++++++------------- gdb/score-tdep.h | 7 ------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index 078315a..c224189 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -1447,6 +1447,12 @@ score7_linux_supply_gregset(const struct regset *regset, } } +static const struct regset score7_linux_gregset = + { + NULL, + score7_linux_supply_gregset, NULL + }; + /* Return the appropriate register set from the core section identified by SECT_NAME and SECT_SIZE. */ @@ -1454,20 +1460,11 @@ static const struct regset * score7_linux_regset_from_core_section(struct gdbarch *gdbarch, const char *sect_name, size_t sect_size) { - struct gdbarch_tdep *tdep; - gdb_assert (gdbarch != NULL); gdb_assert (sect_name != NULL); - tdep = gdbarch_tdep (gdbarch); - if (strcmp(sect_name, ".reg") == 0 && sect_size == sizeof(elf_gregset_t)) - { - if (tdep->gregset == NULL) - tdep->gregset = regset_alloc (gdbarch, - score7_linux_supply_gregset, NULL); - return tdep->gregset; - } + return &score7_linux_gregset; return NULL; } @@ -1476,7 +1473,6 @@ static struct gdbarch * score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; - struct gdbarch_tdep *tdep; target_mach = info.bfd_arch_info->mach; arches = gdbarch_list_lookup_by_info (arches, &info); @@ -1484,8 +1480,7 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { return (arches->gdbarch); } - tdep = xcalloc(1, sizeof(struct gdbarch_tdep)); - gdbarch = gdbarch_alloc (&info, tdep); + gdbarch = gdbarch_alloc (&info, NULL); set_gdbarch_short_bit (gdbarch, 16); set_gdbarch_int_bit (gdbarch, 32); diff --git a/gdb/score-tdep.h b/gdb/score-tdep.h index b34f5a9..02a334e 100644 --- a/gdb/score-tdep.h +++ b/gdb/score-tdep.h @@ -49,13 +49,6 @@ enum gdb_regnum /* Forward declarations. */ struct regset; -/* Target-dependent structure in gdbarch */ -struct gdbarch_tdep -{ - /* Cached core file helpers. */ - struct regset *gregset; -}; - /* Linux Core file support (dirty hack) S+core Linux register set definition, copy from S+core Linux. */