From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id 1BB003858D28 for ; Mon, 8 May 2023 16:51:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BB003858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4QFS4F6PKVz3rjt; Mon, 8 May 2023 16:51:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QFS4F5TBcz3kYr; Mon, 8 May 2023 16:51:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683564701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LnqiCgPshlnSogl9O4nTxLEcVFvGTPw2bxsAMnuyERM=; b=H0JgxN8qsowZYpQ6aJzp/GZQ7pygozCR8niTDvy9neatkg43JqCfkP5Tdysxs6b3zQDIEU j3dkbX2Kjd9yYPSm5Vj2bGU/Ib/hWMwwM7IGX55zo0oGDqovnUHQu4/CN5fvCknE0EvOBH AO3WoR4KZCAOy2mxdTvSWnhfmtATLwmPj0JqMLZj7QqlCyFByx2cGWZ8UCVHG1ij6OKUKD xZCLZiPZkGBKVuHhN5wl4D/BZ8C0AMzA5C8BM2B2llDvfHrvD3H4mzlldc3oyRqHh6koFf /0+lTFzuJpKN1aA1sIoSHo9pIMFQrHhsaxEvjgpaZq4qJe/izrC6FoUr6LSKhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683564701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LnqiCgPshlnSogl9O4nTxLEcVFvGTPw2bxsAMnuyERM=; b=DvhBN3CnVtS3e2SvPuqMKFYZkYU/H+GP28TZaDrauflsYWuDWuTjbh5DrrTUW3oNt61hqD wI+HSBGjSEqmFqjk5tAxz3TPfmkvnsyaVn3q5gop+AjA+rn9JTUYiy1Ikq1iWlGE0W/9xK pqNIS6WW8KtNyLQD05dAChheXywikFQ/U2/4j29X8alhY2yva4+IqykJBL/LLbn+jK5vPC LWj1L+UaA3G13CwAXp7NoJ2YJwSO4BWwKxhIlI+tYS2crgCc56UUwC6HINLNCJYCALyuRg EYDbnXAFPEjUxMG04w2f5OOeDx4cg5GKhfOHfGjJivjcuPgCTKSxuwBu/4o0cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683564701; a=rsa-sha256; cv=none; b=oCokphOzE93H6lJsHYtta7WGkR59qZdo7RtlzOC2yLAvmcIHGN89xi2mD+u3tsapfl1TwJ rLeG/Dn7d8LN6nU7HDcb+DErXcMWfolPsg7pAdBTwQtg/T80IcASiM0xwZUwjrUYNJiZkX ei6z2bb4XEYugjqbT8spoAkJwWC2EpC8BHc/XfFyEV0ZOH7wreRnz1123bBsGihgezOitg jg8qWpe7L1jJ+5Su5cCOGR+BUvkyTaV0o/b+I1q/wt5UKWYhR5HCMp1pmP+BWtJdN0l4xU pK6yJIrpvorKVR1Ce74rnii3SrwSJu20E83KIHSZIjEt7sdfTJl30GSLUPLh2g== Received: from [IPV6:2601:648:8680:16b0:9597:2b45:6d3:31cd] (unknown [IPv6:2601:648:8680:16b0:9597:2b45:6d3:31cd]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4QFS4F2kpMzw7H; Mon, 8 May 2023 16:51:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Mon, 8 May 2023 09:51:40 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org References: <20230427210113.45380-1-jhb@FreeBSD.org> <20230427210113.45380-3-jhb@FreeBSD.org> From: John Baldwin Subject: Re: [PATCH v5 02/19] gdb: Store an x86_xsave_layout in i386_gdbarch_tdep. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,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 5/3/23 9:22 AM, Simon Marchi wrote: > 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. Humm, this is is target-delegates.c which is generated by make-target-delegates.py. The current version of this file also has an extra blank line of EOF. >> --- >> 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. Ok. I had thought this pattern was used more consistently in various *gdbarch_init routines, but looking at them now, aarch64 does an early return as you mention, and MIPS does a weird hybrid. riscv does something akin to the above. I'll change it to do a == and quick return. I did have to update patch 1 to add an operator== for this to work FYI. > Other than that: > > Approved-By: Simon Marchi > > Simon -- John Baldwin