This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] gdbserver: xtensa: support THREADPTR register
- From: Max Filippov <jcmvbkbc at gmail dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org, Maxim Grigoriev <maxim2405 at gmail dot com>, Woody LaRue <larue at cadence dot com>, Marc Gauthier <marc at cadence dot com>
- Date: Tue, 14 Feb 2017 01:37:33 -0800
- Subject: Re: [PATCH 2/2] gdbserver: xtensa: support THREADPTR register
- Authentication-results: sourceware.org; auth=none
- References: <1484783816-13856-1-git-send-email-jcmvbkbc@gmail.com> <1484783816-13856-3-git-send-email-jcmvbkbc@gmail.com> <364bac02-7144-6c16-e215-253bc56ee5a6@codesourcery.com>
On Mon, Feb 13, 2017 at 10:26 AM, Luis Machado
<lgustavo@codesourcery.com> wrote:
> On 01/18/2017 05:56 PM, Max Filippov wrote:
>>
>> Provide aceess to the THREADPTR register to remote gdb.
>>
>> 2017-01-18 Max Filippov <jcmvbkbc@gmail.com>
>> gdb/gdbserver/
>
>
>
> Similarly, drop the gdb/gdbserver/
>
>> * linux-xtensa-low.c (regnum::R_THREADPTR): New enum member.
>> (xtensa_fill_gregset): Call collect_register_by_name for
>> threadptr register.
>> (xtensa_store_gregset): Call supply_register_by_name for
>> threadptr register.
>> ---
>> gdb/gdbserver/linux-xtensa-low.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/gdb/gdbserver/linux-xtensa-low.c
>> b/gdb/gdbserver/linux-xtensa-low.c
>> index 73fbfe2..eca0289 100644
>> --- a/gdb/gdbserver/linux-xtensa-low.c
>> +++ b/gdb/gdbserver/linux-xtensa-low.c
>> @@ -36,6 +36,7 @@ enum regnum {
>> R_LBEG, R_LEND, R_LCOUNT,
>> R_SAR,
>> R_WS, R_WB,
>> + R_THREADPTR,
>> R_A0 = 64
>> };
>
>
> Does xtensa have xml register description support?
AFAIK no.
> It would be nice to have
> those described instead of hardcoding the entries like this.
>>
>> @@ -86,6 +87,10 @@ xtensa_fill_gregset (struct regcache *regcache, void
>> *buf)
>> collect_register (regcache, i, ptr);
>> ptr += register_size (tdesc, i);
>> }
>> +
>> +#if XCHAL_HAVE_THREADPTR
>> + collect_register_by_name (regcache, "threadptr",
>> (char*)&rset[R_THREADPTR]);
>
>
> Missing spaces in the cast. "(char *) &rset[R_THREADPTR]"
Will add.
> How is XCHAL_HAVE_THREADPTR set?
It is defined in the core configuration overlay, include/xtensa-config.h
This file is generated for each Xtensa core and is copied over to the
source tree before building gdb for that specific core.
> Is it a reliable way of confirming the presence of this register?
This is the primary source of configuration-specific information.
> Can a runtime check be used instead?
AFAIK this information is not provided anywhere else.
>> +#endif
>> }
>>
>> static void
>> @@ -133,6 +138,10 @@ xtensa_store_gregset (struct regcache *regcache,
>> const void *buf)
>> supply_register_by_name (regcache, "ps", (char*)&rset[R_PS]);
>> supply_register_by_name (regcache, "windowbase", (char*)&rset[R_WB]);
>> supply_register_by_name (regcache, "windowstart", (char*)&rset[R_WS]);
>> +
>> +#if XCHAL_HAVE_THREADPTR
>> + supply_register_by_name (regcache, "threadptr",
>> (char*)&rset[R_THREADPTR]);
>
>
> Same as above regarding spaces and the cast construct and the
> XCHAL_HAVE_THREADPTR check.
Will fix.
--
Thanks.
-- Max