Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: "Schimpe, Christina" <christina.schimpe@intel.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "thiago.bauermann@linaro.org" <thiago.bauermann@linaro.org>,
	"eliz@gnu.org" <eliz@gnu.org>
Subject: Re: [PATCH v4 04/11] gdb, gdbserver: Use xstate_bv for target description creation on x86.
Date: Thu, 26 Jun 2025 17:03:18 +0100	[thread overview]
Message-ID: <60394d33-98e9-444e-98e9-fb30d60f399f@arm.com> (raw)
In-Reply-To: <SN7PR11MB7638EACF7F3B5E4FF9F76486F978A@SN7PR11MB7638.namprd11.prod.outlook.com>

On 6/24/25 14:46, Schimpe, Christina wrote:
> Hi Luis, 
> 
>> -----Original Message-----
>> From: Luis Machado <luis.machado@arm.com>
>> Sent: Monday, June 23, 2025 2:56 PM
>> To: Schimpe, Christina <christina.schimpe@intel.com>; gdb-
>> patches@sourceware.org
>> Cc: thiago.bauermann@linaro.org; eliz@gnu.org
>> Subject: Re: [PATCH v4 04/11] gdb, gdbserver: Use xstate_bv for target
>> description creation on x86.
>>
>> On 6/23/25 13:46, Schimpe, Christina wrote:
>>> Hi Luis,
>>>
>>> Thanks a lot for the feedback. Please find my comments below.
>>>
>>>> -----Original Message-----
>>>> From: Luis Machado <luis.machado@arm.com>
>>>> Sent: Thursday, June 19, 2025 11:24 AM
>>>> To: Schimpe, Christina <christina.schimpe@intel.com>; gdb-
>>>> patches@sourceware.org
>>>> Cc: thiago.bauermann@linaro.org; eliz@gnu.org
>>>> Subject: Re: [PATCH v4 04/11] gdb, gdbserver: Use xstate_bv for
>>>> target description creation on x86.
>>>>
>>>> On 6/17/25 13:11, Christina Schimpe wrote:
>>>>> diff --git a/gdb/arch/amd64.c b/gdb/arch/amd64.c index
>>>>> 252650b6390..9cac0645cdc 100644
>>>>> --- a/gdb/arch/amd64.c
>>>>> +++ b/gdb/arch/amd64.c
>>>>> @@ -30,14 +30,11 @@
>>>>>
>>>>>  #include "../features/i386/x32-core.c"
>>>>>
>>>>> -/* Create amd64 target descriptions according to XCR0.  If IS_X32 is
>>>>> -   true, create the x32 ones.  If IS_LINUX is true, create target
>>>>> -   descriptions for Linux.  If SEGMENTS is true, then include
>>>>> -   the "org.gnu.gdb.i386.segments" feature registers.  */
>>>>> +/* See amd64.h.  */
>>>>
>>>> More appropriate to reference arch/amd64.h.
>>>
>>> True, will fix.
>>>
>>>>
>>>>>
>>>>>  target_desc *
>>>>> -amd64_create_target_description (uint64_t xcr0, bool is_x32, bool
>> is_linux,
>>>>> -				 bool segments)
>>>>> +amd64_create_target_description (uint64_t xstate_bv_mask, bool is_x32,
>>>>> +				 bool is_linux, bool segments)
>>>>>  {
>>>>>    target_desc_up tdesc = allocate_target_description ();
>>>>>
>>>>> @@ -62,13 +59,13 @@ amd64_create_target_description (uint64_t xcr0,
>>>> bool is_x32, bool is_linux,
>>>>>    if (segments)
>>>>>      regnum = create_feature_i386_64bit_segments (tdesc.get (),
>>>>> regnum);
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_AVX)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_AVX)
>>>>>      regnum = create_feature_i386_64bit_avx (tdesc.get (), regnum);
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_AVX512)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_AVX512)
>>>>>      regnum = create_feature_i386_64bit_avx512 (tdesc.get (),
>>>>> regnum);
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_PKRU)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_PKRU)
>>>>>      regnum = create_feature_i386_pkeys (tdesc.get (), regnum);
>>>>>
>>>>>    return tdesc.release ();
>>>>
>>>> <...>
>>>>
>>>>> diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c index
>>>>> 835df53c75d..84f31439e7a 100644
>>>>> --- a/gdb/arch/i386.c
>>>>> +++ b/gdb/arch/i386.c
>>>>> @@ -29,10 +29,11 @@
>>>>>  #include "../features/i386/32bit-segments.c"
>>>>>  #include "../features/i386/pkeys.c"
>>>>>
>>>>> -/* Create i386 target descriptions according to XCR0.  */
>>>>> +/* See i386.h.  */
>>>>
>>>> arch/i386.h
>>>
>>> Will fix.
>>>
>>>>
>>>>>
>>>>>  target_desc *
>>>>> -i386_create_target_description (uint64_t xcr0, bool is_linux, bool
>>>>> segments)
>>>>> +i386_create_target_description (uint64_t xstate_bv_mask, bool is_linux,
>>>>> +				bool segments)
>>>>>  {
>>>>>    target_desc_up tdesc = allocate_target_description ();
>>>>>
>>>>> @@ -44,10 +45,10 @@ i386_create_target_description (uint64_t xcr0,
>>>>> bool is_linux, bool segments)
>>>>>
>>>>>    long regnum = 0;
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_X87)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_X87)
>>>>>      regnum = create_feature_i386_32bit_core (tdesc.get (), regnum);
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_SSE)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_SSE)
>>>>>      regnum = create_feature_i386_32bit_sse (tdesc.get (), regnum);
>>>>>
>>>>>    if (is_linux)
>>>>> @@ -56,13 +57,13 @@ i386_create_target_description (uint64_t xcr0,
>>>>> bool
>>>> is_linux, bool segments)
>>>>>    if (segments)
>>>>>      regnum = create_feature_i386_32bit_segments (tdesc.get (),
>>>>> regnum);
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_AVX)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_AVX)
>>>>>      regnum = create_feature_i386_32bit_avx (tdesc.get (), regnum);
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_AVX512)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_AVX512)
>>>>>      regnum = create_feature_i386_32bit_avx512 (tdesc.get (),
>>>>> regnum);
>>>>>
>>>>> -  if (xcr0 & X86_XSTATE_PKRU)
>>>>> +  if (xstate_bv_mask & X86_XSTATE_PKRU)
>>>>>      regnum = create_feature_i386_pkeys (tdesc.get (), regnum);
>>>>>
>>>>>    return tdesc.release ();
>>>>
>>>> <...>
>>>>
>>>>> diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index
>>>>> fc7c5f642ed..a82ad21da27 100644
>>>>> --- a/gdb/x86-linux-nat.c
>>>>> +++ b/gdb/x86-linux-nat.c
>>>>> @@ -97,15 +97,20 @@ const struct target_desc *
>>>>> x86_linux_nat_target::read_description ()  {
>>>>>    /* The x86_linux_tdesc_for_tid call only reads xcr0 the first time it is
>>>>> -     called, the xcr0 value is stored here and reused on subsequent calls.  */
>>>>> -  static uint64_t xcr0_storage;
>>>>> +     called.  The mask is stored in XSTATE_BV_STORAGE and reused on
>>>>> +     subsequent calls.  Note that GDB currently supports features for user
>>>>> +     state components only.  However, once supervisor state components
>> are
>>>>> +     supported in GDB XSTATE_BV_STORAGE will not be configured based
>> on
>>>>> +     xcr0 only.  */
>>>>
>>>> Something about the comment above reads off in the last phrase. Is
>>>> there a missing connection word?
>>>
>>> I agree, would this be a bit better?
>>>
>>> "However, once supervisor state components are supported in GDB, the
>>> value XSTATE_BV_STORAGE will not be configured based on xcr0 only."
>>>
>>
>> Yes, that reads better, thanks.
>>
>> I don't think you need a new iteration for these fixes though. They could be
>> local.
> 
> Just to be sure, you mean for this patch or your comments on the series in general?
> 

I meant on this patch. Sorry, missed this reply.

  reply	other threads:[~2025-06-26 16:04 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17 12:11 [PATCH v4 00/11] Add CET shadow stack support Christina Schimpe
2025-06-17 12:11 ` [PATCH v4 01/11] gdbserver: Add optional runtime register set type Christina Schimpe
2025-06-19  9:27   ` Luis Machado
2025-06-17 12:11 ` [PATCH v4 02/11] gdbserver: Add assert in x86_linux_read_description Christina Schimpe
2025-06-19  9:27   ` Luis Machado
2025-06-17 12:11 ` [PATCH v4 03/11] gdb: Sync up x86-gcc-cpuid.h with cpuid.h from gcc 14 branch Christina Schimpe
2025-06-17 18:12   ` Tom Tromey
2025-06-20 12:39     ` Schimpe, Christina
2025-06-17 12:11 ` [PATCH v4 04/11] gdb, gdbserver: Use xstate_bv for target description creation on x86 Christina Schimpe
2025-06-19  9:23   ` Luis Machado
2025-06-23 12:46     ` Schimpe, Christina
2025-06-23 12:56       ` Luis Machado
2025-06-24 13:46         ` Schimpe, Christina
2025-06-26 16:03           ` Luis Machado [this message]
2025-06-17 12:11 ` [PATCH v4 05/11] gdb, gdbserver: Add support of Intel shadow stack pointer register Christina Schimpe
2025-06-17 12:20   ` Eli Zaretskii
2025-06-19  9:24   ` Luis Machado
2025-06-23 13:05     ` Schimpe, Christina
2025-06-17 12:11 ` [PATCH v4 06/11] gdb: amd64 linux coredump support with shadow stack Christina Schimpe
2025-06-19  9:24   ` Luis Machado
2025-06-23 13:16     ` Schimpe, Christina
2025-06-17 12:11 ` [PATCH v4 07/11] gdb: Handle shadow stack pointer register unwinding for amd64 linux Christina Schimpe
2025-06-19  9:25   ` Luis Machado
2025-06-20  1:42     ` Thiago Jung Bauermann
2025-06-23 14:55       ` Schimpe, Christina
2025-06-23 23:26         ` Thiago Jung Bauermann
2025-06-23 15:00     ` Schimpe, Christina
2025-06-23 15:06       ` Luis Machado
2025-06-23 23:36         ` Thiago Jung Bauermann
2025-06-20  1:52   ` Thiago Jung Bauermann
2025-06-17 12:11 ` [PATCH v4 08/11] gdb, gdbarch: Enable inferior calls for shadow stack support Christina Schimpe
2025-06-19  9:25   ` Luis Machado
2025-06-23 17:49     ` Schimpe, Christina
2025-06-17 12:11 ` [PATCH v4 09/11] gdb: Implement amd64 linux shadow stack support for inferior calls Christina Schimpe
2025-06-17 12:21   ` Eli Zaretskii
2025-06-19  9:25   ` Luis Machado
2025-06-27 19:52     ` Schimpe, Christina
2025-06-28 10:38       ` Luis Machado
2025-06-28 20:03         ` Thiago Jung Bauermann
2025-06-28 21:05           ` Thiago Jung Bauermann
2025-06-17 12:11 ` [PATCH v4 10/11] gdb, gdbarch: Introduce gdbarch method to get the shadow stack pointer Christina Schimpe
2025-06-17 18:16   ` Tom Tromey
2025-06-20 12:59     ` Schimpe, Christina
2025-06-19  9:26   ` Luis Machado
2025-06-23 18:00     ` Schimpe, Christina
2025-06-17 12:11 ` [PATCH v4 11/11] gdb: Enable displaced stepping with shadow stack on amd64 linux Christina Schimpe
2025-06-17 12:22   ` Eli Zaretskii
2025-06-17 15:16     ` Schimpe, Christina
2025-06-19  9:26   ` Luis Machado
2025-06-23 18:24     ` Schimpe, Christina
2025-06-24  8:05       ` Luis Machado
2025-06-27 19:26         ` Schimpe, Christina
2025-06-28 10:35           ` Luis Machado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60394d33-98e9-444e-98e9-fb30d60f399f@arm.com \
    --to=luis.machado@arm.com \
    --cc=christina.schimpe@intel.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=thiago.bauermann@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox