From patchwork Sat Apr 14 19:09:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 26733 Received: (qmail 32988 invoked by alias); 14 Apr 2018 19:19:08 -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 32975 invoked by uid 89); 14 Apr 2018 19:19:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.2 spammy=2999, our 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; Sat, 14 Apr 2018 19:19:06 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 857F1818595A for ; Sat, 14 Apr 2018 19:10:14 +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 36509215CDC8 for ; Sat, 14 Apr 2018 19:10:14 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 30/40] target_ops/C++: Xtensa GNU/Linux Date: Sat, 14 Apr 2018 20:09:43 +0100 Message-Id: <20180414190953.24481-31-palves@redhat.com> In-Reply-To: <20180414190953.24481-1-palves@redhat.com> References: <20180414190953.24481-1-palves@redhat.com> Straighforward conversion. Not tested. --- gdb/xtensa-linux-nat.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c index eac68bbb26..2acffbfbdf 100644 --- a/gdb/xtensa-linux-nat.c +++ b/gdb/xtensa-linux-nat.c @@ -45,6 +45,16 @@ hardware-specific overlays. */ #include "xtensa-xtregs.c" +class xtensa_linux_nat_target final : public linux_nat_target +{ +public: + /* Add our register access methods. */ + void fetch_registers (struct regcache *, int) override; + void store_registers (struct regcache *, int) override; +}; + +static xtensa_linux_nat_target the_xtensa_linux_nat_target; + void fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp, int regnum) @@ -289,9 +299,9 @@ store_xtregs (struct regcache *regcache, int regnum) perror_with_name (_("Couldn't write extended registers")); } -static void -xtensa_linux_fetch_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) +void +xtensa_linux_nat_target::fetch_registers (struct regcache *regcache, + int regnum) { if (regnum == -1) { @@ -304,9 +314,9 @@ xtensa_linux_fetch_inferior_registers (struct target_ops *ops, fetch_xtregs (regcache, regnum); } -static void -xtensa_linux_store_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) +void +xtensa_linux_nat_target::store_registers (struct regcache *regcache, + int regnum) { if (regnum == -1) { @@ -341,7 +351,6 @@ ps_get_thread_area (struct ps_prochandle *ph, void _initialize_xtensa_linux_nat (void) { - struct target_ops *t; const xtensa_regtable_t *ptr; /* Calculate the number range for extended registers. */ @@ -355,12 +364,5 @@ _initialize_xtensa_linux_nat (void) xtreg_high = ptr->gdb_regnum; } - /* Fill in the generic GNU/Linux methods. */ - t = linux_target (); - - /* Add our register access methods. */ - t->to_fetch_registers = xtensa_linux_fetch_inferior_registers; - t->to_store_registers = xtensa_linux_store_inferior_registers; - - linux_nat_add_target (t); + add_target (&the_xtensa_linux_nat_target); }