From patchwork Fri May 3 23:12:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32534 Received: (qmail 2597 invoked by alias); 3 May 2019 23:12:57 -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 729 invoked by uid 89); 3 May 2019 23:12:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.214) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 May 2019 23:12:41 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 87F9431E3902 for ; Fri, 3 May 2019 18:12:40 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id MhM8htK0i2PzOMhM8hMXcz; Fri, 03 May 2019 18:12:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GvDmQNzNr5dRi+2hNidPn2AOBOF6toct6YtVpDoXsjM=; b=CYxrzz6j200K5LGfhzWhCzcPK9 Ma2gBrwsIYg2qz77dLhiuezQJL1qWmu/VBWNJhr37MyswwYyPp5RYeeEn8VABV9TdtMo9znz9Po/R XiBQzlrDTZuq+czYWG91+8Z3X; Received: from 97-122-168-123.hlrn.qwest.net ([97.122.168.123]:37502 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1hMhM8-003AAO-B8; Fri, 03 May 2019 18:12:40 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 26/31] Convert hppa-tdep.c to type-safe registry API Date: Fri, 3 May 2019 17:12:26 -0600 Message-Id: <20190503231231.8954-27-tom@tromey.com> In-Reply-To: <20190503231231.8954-1-tom@tromey.com> References: <20190503231231.8954-1-tom@tromey.com> This changes hppa-tdep.c to use the type-safe registry API. 2019-05-01 Tom Tromey * hppa-tdep.c (hppa_objfile_priv_data): Change type. (hppa_init_objfile_priv_data, read_unwind_info) (find_unwind_entry, _initialize_hppa_tdep): Update. --- gdb/ChangeLog | 6 ++++++ gdb/hppa-tdep.c | 17 +++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index d2b3336cfc7..be30359638c 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -84,7 +84,9 @@ struct hppa_objfile_private that separately and make this static. The solib data is probably hpux- specific, so we can create a separate extern objfile_data that is registered by hppa-hpux-tdep.c and shared with pa64solib.c and somsolib.c. */ -static const struct objfile_data *hppa_objfile_priv_data = NULL; +static const struct objfile_key> + hppa_objfile_priv_data; /* Get at various relevent fields of an instruction word. */ #define MASK_5 0x1f @@ -208,7 +210,7 @@ hppa_init_objfile_priv_data (struct objfile *objfile) hppa_objfile_private *priv = OBSTACK_ZALLOC (&objfile->objfile_obstack, hppa_objfile_private); - set_objfile_data (objfile, hppa_objfile_priv_data, priv); + hppa_objfile_priv_data.set (objfile, priv); return priv; } @@ -466,8 +468,7 @@ read_unwind_info (struct objfile *objfile) compare_unwind_entries); /* Keep a pointer to the unwind information. */ - obj_private = (struct hppa_objfile_private *) - objfile_data (objfile, hppa_objfile_priv_data); + obj_private = hppa_objfile_priv_data.get (objfile); if (obj_private == NULL) obj_private = hppa_init_objfile_priv_data (objfile); @@ -501,16 +502,14 @@ find_unwind_entry (CORE_ADDR pc) { struct hppa_unwind_info *ui; ui = NULL; - priv = ((struct hppa_objfile_private *) - objfile_data (objfile, hppa_objfile_priv_data)); + priv = hppa_objfile_priv_data.get (objfile); if (priv) ui = ((struct hppa_objfile_private *) priv)->unwind_info; if (!ui) { read_unwind_info (objfile); - priv = ((struct hppa_objfile_private *) - objfile_data (objfile, hppa_objfile_priv_data)); + priv = hppa_objfile_priv_data.get (objfile); if (priv == NULL) error (_("Internal error reading unwind information.")); ui = ((struct hppa_objfile_private *) priv)->unwind_info; @@ -3174,8 +3173,6 @@ _initialize_hppa_tdep (void) { gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep); - hppa_objfile_priv_data = register_objfile_data (); - add_cmd ("unwind", class_maintenance, unwind_command, _("Print unwind table entry at given address."), &maintenanceprintlist);