From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qE0dEWtRcl+NMQAAWB0awg (envelope-from ) for ; Mon, 28 Sep 2020 17:11:07 -0400 Received: by simark.ca (Postfix, from userid 112) id 2B19D1E591; Mon, 28 Sep 2020 17:11:07 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 607611E58E for ; Mon, 28 Sep 2020 17:11:06 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0B043986023; Mon, 28 Sep 2020 21:11:05 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 192393971C46 for ; Mon, 28 Sep 2020 21:11:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 192393971C46 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id BD9D21E58E; Mon, 28 Sep 2020 17:11:01 -0400 (EDT) Subject: Re: [PATCH 3/5] Refactor the NetBSD amd64 gdbserver support To: Kamil Rytarowski , gdb-patches@sourceware.org References: <20200923042515.28245-1-n54@gmx.com> <20200923042515.28245-4-n54@gmx.com> From: Simon Marchi Message-ID: Date: Mon, 28 Sep 2020 17:11:01 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200923042515.28245-4-n54@gmx.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2020-09-23 12:25 a.m., Kamil Rytarowski wrote: > Replace the pre-C++ construct of netbsd_target_ops, netbsd_regset_info > and netbsd_tdesc with C++ inheritance approach found in the Linux > gdbserver code. Add netbsd_amd64_target, that inherits from the > netbsd_process_target class and add proper singleton object for > the_netbsd_target, initialized from netbsd_amd64_target. > > Call low_arch_setup () on post process creation, which sets machine > specific properties of the traced process. > > Remove global singleton the_netbsd_target object from the generic > gdbserver code. > > This refactoring introduces no functional change from the end-user > point of view. I just spotted some nits, but otherwise the patch is OK. > diff --git a/gdbserver/netbsd-amd64-low.cc b/gdbserver/netbsd-amd64-low.cc > index 9b8ea9b8aa6..2324bdbbfea 100644 > --- a/gdbserver/netbsd-amd64-low.cc > +++ b/gdbserver/netbsd-amd64-low.cc > @@ -155,22 +155,9 @@ netbsd_x86_64_store_gregset (struct regcache *regcache, const char *buf) > netbsd_x86_64_supply_gp (AMD64_GS_REGNUM, GS); > } > > -/* Implements the netbsd_target_ops.arch_setup routine. */ > - > -static void > -netbsd_x86_64_arch_setup (void) > -{ > - struct target_desc *tdesc > - = amd64_create_target_description (X86_XSTATE_SSE_MASK, false, false, false); > - > - init_target_desc (tdesc, amd64_expedite_regs); > - > - netbsd_tdesc = tdesc; > -} > - > /* Description of all the x86-netbsd register sets. */ > > -struct netbsd_regset_info netbsd_target_regsets[] = > +const static struct netbsd_regset_info netbsd_target_regsets[] = "const static" -> "static const", just for consistency. > @@ -504,7 +506,7 @@ netbsd_process_target::thread_alive (ptid_t ptid) > void > netbsd_process_target::fetch_registers (struct regcache *regcache, int regno) > { > - struct netbsd_regset_info *regset = netbsd_target_regsets; > + const netbsd_regset_info *regset = get_regs_info(); Space before parenthesis. > ptid_t inferior_ptid = ptid_of (current_thread); > > while (regset->size >= 0) > @@ -525,7 +527,7 @@ netbsd_process_target::fetch_registers (struct regcache *regcache, int regno) > void > netbsd_process_target::store_registers (struct regcache *regcache, int regno) > { > - struct netbsd_regset_info *regset = netbsd_target_regsets; > + const netbsd_regset_info *regset = get_regs_info(); Space before parenthesis. Simon