From patchwork Thu May 15 15:49:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 939 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id CB1D9360110 for ; Thu, 15 May 2014 08:49:57 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 86F9363CF9D4A; Thu, 15 May 2014 08:49:57 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.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-mx23.g.dreamhost.com (Postfix) with ESMTPS id 5B1F863CF9D42 for ; Thu, 15 May 2014 08:49:57 -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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=uMwFua+9zeO3U3UwQ3HB9OI65iMhuF7 bLDZKkTkaZsUixTcH73wp0YkJVuLVeOtSDJ/n1SfKbkyX6gNY1QaO0Zwqn98uHa7 OpRIaHOCdCtriluL66xWcqgPJ8i4taMMqiq8DlKiaTSkhTrCycLZvfbeI2lqUU00 lyP9jF4yXq7U= 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:subject:date:message-id:in-reply-to :references; s=default; bh=BxBVRMMsY1/ZlRWibVILBBk0/pk=; b=a4G3k wh108Ze1wveygvxbdSqgMMMMhWCTJVLMaTO8USY1Y99tgiLuQM0qQ9TE3YB/qDAE U8CKWA8nxIx16KfQWE+R2M/sRbKKezqf4dCUmvhMKAfr0pN5Jc67QGwBSaKN6FMp 45X2pkTp+BcWq+C93HI1qjoA5mB7LSLi0WqY1w= Received: (qmail 30960 invoked by alias); 15 May 2014 15:49:44 -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 30773 invoked by uid 89); 15 May 2014 15:49:43 -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: e06smtp14.uk.ibm.com Received: from e06smtp14.uk.ibm.com (HELO e06smtp14.uk.ibm.com) (195.75.94.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 15 May 2014 15:49:41 +0000 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 May 2014 16:49:38 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 15 May 2014 16:49:37 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 7710717D805F for ; Thu, 15 May 2014 16:50:46 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4FFnbXC57016498 for ; Thu, 15 May 2014 15:49:37 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 s4FFnbVg017518 for ; Thu, 15 May 2014 09:49:37 -0600 Received: from br87z6lw.boeblingen.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 s4FFnZVV017450 for ; Thu, 15 May 2014 09:49:36 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH 08/11] SCORE: Replace regset_alloc() invocation by a static regset structure. Date: Thu, 15 May 2014 17:49:32 +0200 Message-Id: <1400168975-3145-9-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1400168975-3145-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1400168975-3145-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14051515-1948-0000-0000-000008CD3D4D 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. */