From patchwork Sat Apr 14 19:09:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 26722 Received: (qmail 127417 invoked by alias); 14 Apr 2018 19:10:36 -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 126887 invoked by uid 89); 14 Apr 2018 19:10:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 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=a.out, aout, UD:out, sk:store_i 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:10:30 +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 E69DFEB703 for ; Sat, 14 Apr 2018 19:10:13 +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 9742F215CDC8 for ; Sat, 14 Apr 2018 19:10:13 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 29/40] target_ops/C++: Tile-Gx GNU/Linux Date: Sat, 14 Apr 2018 20:09:42 +0100 Message-Id: <20180414190953.24481-30-palves@redhat.com> In-Reply-To: <20180414190953.24481-1-palves@redhat.com> References: <20180414190953.24481-1-palves@redhat.com> Straighforward conversion. Not tested. --- gdb/tilegx-linux-nat.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gdb/tilegx-linux-nat.c b/gdb/tilegx-linux-nat.c index d7c14f0565..0df98e6ffc 100644 --- a/gdb/tilegx-linux-nat.c +++ b/gdb/tilegx-linux-nat.c @@ -34,6 +34,16 @@ /* Prototypes for supply_gregset etc. */ #include "gregset.h" +class tilegx_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 tilegx_linux_nat_target the_tilegx_linux_nat_target; + /* The register sets used in GNU/Linux ELF core-dumps are identical to the register sets in `struct user' that is used for a.out core-dumps, and is also used by `ptrace'. The corresponding types @@ -122,9 +132,9 @@ fill_fpregset (const struct regcache *regcache, /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this for all registers. */ -static void -fetch_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) +void +tilegx_linux_nat_target::fetch_registers (struct regcache *regcache, + int regnum) { elf_gregset_t regs; pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); @@ -138,9 +148,9 @@ fetch_inferior_registers (struct target_ops *ops, /* Store register REGNUM back into the inferior. If REGNUM is -1, do this for all registers. */ -static void -store_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) +void +tilegx_linux_nat_target::store_registers (struct regcache *regcache, + int regnum) { elf_gregset_t regs; pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); @@ -157,15 +167,5 @@ store_inferior_registers (struct target_ops *ops, void _initialize_tile_linux_nat (void) { - struct target_ops *t; - - /* Fill in the generic GNU/Linux methods. */ - t = linux_target (); - - /* Add our register access methods. */ - t->to_fetch_registers = fetch_inferior_registers; - t->to_store_registers = store_inferior_registers; - - /* Register the target. */ - linux_nat_add_target (t); + add_target (&the_tilegx_linux_nat_target); }