public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: Luis Machado <lgustavo@codesourcery.com>
Cc: gdb-patches@sourceware.org, Maxim Grigoriev <maxim2405@gmail.com>,
		Woody LaRue <larue@cadence.com>,
	Marc Gauthier <marc@cadence.com>
Subject: Re: [PATCH 2/2] gdbserver: xtensa: support THREADPTR register
Date: Tue, 14 Feb 2017 09:37:00 -0000	[thread overview]
Message-ID: <CAMo8BfK8+Xmu7PtV6bd1Cm85B-6egSKzH43qzXWM0k0cufLOYw@mail.gmail.com> (raw)
In-Reply-To: <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

  reply	other threads:[~2017-02-14  9:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 23:57 [PATCH 0/2] " Max Filippov
2017-01-18 23:57 ` [PATCH 1/2] gdb: xtensa-linux: " Max Filippov
2017-02-13 18:17   ` Luis Machado
2017-02-14  9:06     ` Max Filippov
2017-02-14  9:58       ` Luis Machado
2017-01-18 23:57 ` [PATCH 2/2] gdbserver: xtensa: " Max Filippov
2017-02-13 18:26   ` Luis Machado
2017-02-14  9:37     ` Max Filippov [this message]
2017-01-26 19:12 ` [PATCH 0/2] " Max Filippov

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=CAMo8BfK8+Xmu7PtV6bd1Cm85B-6egSKzH43qzXWM0k0cufLOYw@mail.gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=larue@cadence.com \
    --cc=lgustavo@codesourcery.com \
    --cc=marc@cadence.com \
    --cc=maxim2405@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).