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 48D173858D32 for ; Mon, 8 May 2023 17:33:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 48D173858D32 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 4QFT000wWsz41Tt; Mon, 8 May 2023 17:33:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4QFT0006gRz3nhL; Mon, 8 May 2023 17:33:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683567184; 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=BC8Q2mVB5IiSxJTS3mvMEz3ND6lslejJldHNXGUvhG8=; b=wvgRTT2svoSZan5qg1mQ/2ioitcaClBdK7bJVuuHxoXm++ITtC+HlpGSqC/WkYDACMPP4H 7Wsyv7yW3+MVMl/X78smNtZBfZqqyN0kksKNqRJtg47vo8uDoBU1MFUtyaYKfulQ+Kmn+l 1tGO9jC5nOnUNKuP7tL51BiYTt4FmWEabxTuI5YuPjpzSaNCtM/l/YUZOWe6bUddMUJiWU tnOjCUbbsoTkjYV0pgM99FeLhGz5ptKXHrAvG+yXk0FMDuH1Uc6On4DIztD6VvQd5wZ9IX HQdQJXDASW5r3tnSzTPlv2Zrn2/xDtPE5sCBVUKXxtmxi8JA5hbIAyHvxKAU5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683567184; 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=BC8Q2mVB5IiSxJTS3mvMEz3ND6lslejJldHNXGUvhG8=; b=gWxy8yWn60jPLZQW7yLjkvZTCXcQ4IlA/5hoxiIgPym89ZpIWgzJky/aDEXqxvFM1NT4Et sWyeha4Z3k08G7oNFyv7f/maQZh5vBnMf0mvBxVkvPyEDgKt4dqJHbQAKJTdEr46/Hv1eR HNHcIIU9gPhvAX2NWsg++W8MPvx0x7Mwbfz/sUeS6xGS6bhzQ6h/tLRFNPUoIf68JZpwMV TVQPQlV8+JnIpUj0DrzfxYArhFhBMQ+oT8x99yqtZXc+atPpeKt/mSXrrnj2Y94DAOgSR/ auDQu96cGZM0/Dktbis02H9/l02ks40/wl49DdTwn4j/OS5w7nVanaRBbcBHLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683567184; a=rsa-sha256; cv=none; b=mW1IliOKkxOZOkPlV6re45o+JbtaPvYrXt5eRelXtM+AMxwSndgmEyX985HSHb74ZR0Sdt GwpWx/3vKx8E/jGBDtiIpO5NZ3WZ9NT2tKe5dcBGp2rz5HN+HEF8yFz70FcuFrnxH1/+YZ pmkKIRjrKhAbykx3pAJtiMZ8KPyrKULVh4yPX9yM3x0Uh7g3PA8cpwZByUYEfqM/xXJRML pwiH7tzHo23JUiDMGF/bUas0ncT/eKgg1Cn6hiqykzHJI5OHQ6o1PDiIxV7JIiPeRU6eRE KlX84ABk/t6Zx81Z98OKBz8roMYPH0+fSoKCsTgaMbWSDufKvtVyV5NqO4C7RA== 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 4QFSzz4FqzzxFD; Mon, 8 May 2023 17:33:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Mon, 8 May 2023 10:33:02 -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 Subject: Re: [PATCH v5 09/19] gdb: Update x86 FreeBSD architectures to support XSAVE layouts. Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org References: <20230427210113.45380-1-jhb@FreeBSD.org> <20230427210113.45380-10-jhb@FreeBSD.org> <98bf6cc8-f119-b9a9-aef6-94ee366f196c@FreeBSD.org> <5ec7bbaa-6615-f1e0-8846-164789a1ccca@simark.ca> From: John Baldwin In-Reply-To: <5ec7bbaa-6615-f1e0-8846-164789a1ccca@simark.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.2 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/4/23 10:20 AM, Simon Marchi wrote: > On 5/3/23 19:45, John Baldwin wrote: >> On 5/3/23 10:14 AM, Simon Marchi wrote: >>>> diff --git a/gdb/i386-fbsd-tdep.h b/gdb/i386-fbsd-tdep.h >>>> index cb991af9e49..f96c00d45eb 100644 >>>> --- a/gdb/i386-fbsd-tdep.h >>>> +++ b/gdb/i386-fbsd-tdep.h >>>> @@ -20,10 +20,16 @@ >>>> #ifndef I386_FBSD_TDEP_H >>>> #define I386_FBSD_TDEP_H >>>> +#include "gdbsupport/x86-xstate.h" >>>> #include "regset.h" >>>> -/* Get XSAVE extended state xcr0 from core dump. */ >>>> -extern uint64_t i386fbsd_core_read_xcr0 (bfd *abfd); >>>> +/* Validate and fetch XSAVE extended state xcr0 and extended area >>>> + layout from core dump. */ >>>> +uint64_t i386_fbsd_core_read_xsave_info (bfd *abfd, x86_xsave_layout &layout); >>> >>> I was a bit confused when I read the comment above for the first time. >>> Can you rephrase it to make it clear that the function returns the XSAVE >>> extended state, and fills LAYOUT? >>> >>> Also, what does "validate" mean, what happens if the thing we validate >>> is not valid? >> >> Hmm, the intent is "Validate and fetch xcr0 and the XSAVE layout". In >> particular, this does not return the extended state (which would be the >> value of all the AVX registers, etc.) but instead returns only the mask of >> enabled state (xcr0) and the layout of the extended area. >> >> If xcr0 does not appear valid or the section doesn't seem to have a valid >> size (i386_set_xsave_layout returns false) then the function claims that >> only SSE is reported by returning X86_XSTATE_SSE_MASK. That is the >> validation that "validate" is referring to. > > Maybe it's the two "and" in the sentence that make it ambiguous. So, > perhaps: > > Read the xcr0 value from the ABFD core file. If it appears to be valid, > return it and fill LAYOUT with values inferred from that value. > > Otherwise, return X86_XSTATE_SSE_MASK as a fallback and leave LAYOUT > untouched. Yes, that is clearer. I've fixed it here and in the similar commit to i386-linux-tdep.h. -- John Baldwin