From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 1A1963858D28 for ; Wed, 3 May 2023 16:22:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A1963858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.170] (unknown [167.248.160.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 774DA1E0D6; Wed, 3 May 2023 12:22:20 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1683130940; bh=HYN4Lw6AqcD5Czvx1zBVmALSMT3kCQh47CnsqWiiINM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=IHGhB+1R/hJSfbZ01hX3vzm50DSgaaiU3eWnJcPi4fHGqeH5HaCYUMfwjkVKOdFM+ VeF0uzxWL9Ket6Q+0piKjpnN92NwUtJ0Yjkn/ZFIsqhLIzl9g4d3cOSxMQufCq9msQ a3vdMVLJBXCFP9VgxpHrG/aaJvH2vwS4d1r8095k= Message-ID: Date: Wed, 3 May 2023 12:22:19 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH v5 02/19] gdb: Store an x86_xsave_layout in i386_gdbarch_tdep. Content-Language: fr To: John Baldwin , gdb-patches@sourceware.org References: <20230427210113.45380-1-jhb@FreeBSD.org> <20230427210113.45380-3-jhb@FreeBSD.org> From: Simon Marchi In-Reply-To: <20230427210113.45380-3-jhb@FreeBSD.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/27/23 17:00, John Baldwin wrote: > This structure is fetched from the current target in i386_gdbarch_init > via a new "fetch_x86_xsave_layout" target method. I got: Applying: gdb: Store an x86_xsave_layout in i386_gdbarch_tdep. .git/rebase-apply/patch:147: new blank line at EOF. + warning: 1 line adds whitespace errors. > --- > gdb/i386-tdep.c | 19 ++++++++++++++++++- > gdb/i386-tdep.h | 4 ++++ > gdb/target-debug.h | 20 ++++++++++++++++++++ > gdb/target-delegates.c | 27 +++++++++++++++++++++++++++ > gdb/target.c | 6 ++++++ > gdb/target.h | 7 +++++++ > 6 files changed, 82 insertions(+), 1 deletion(-) > > diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c > index 1ab9fc0e87d..43f2ae6c14e 100644 > --- a/gdb/i386-tdep.c > +++ b/gdb/i386-tdep.c > @@ -8504,8 +8504,24 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > int bnd0_regnum; > int num_bnd_cooked; > > + x86_xsave_layout xsave_layout = target_fetch_x86_xsave_layout (); > + > /* If there is already a candidate, use it. */ > - arches = gdbarch_list_lookup_by_info (arches, &info); > + for (arches = gdbarch_list_lookup_by_info (arches, &info); > + arches != NULL; > + arches = gdbarch_list_lookup_by_info (arches->next, &info)) > + { > + /* Check that the XSAVE layout of ARCHES matches the layout for > + the current target. */ > + i386_gdbarch_tdep *other_tdep > + = gdbarch_tdep (arches->gdbarch); > + > + if (other_tdep->xsave_layout != xsave_layout) > + continue; > + > + break; > + } > + > if (arches != NULL) > return arches->gdbarch; I think that returningd from the loop would be a tiny bit simpler (replacing the break with `return arches->gdbarch`. You could drop this if. Other than that: Approved-By: Simon Marchi Simon