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 3/3] gdbserver: xtensa: add call0 support
Date: Tue, 14 Feb 2017 10:04:00 -0000 [thread overview]
Message-ID: <CAMo8BfK8kr9AmVzZj+=PrRXOZxQpkBgVGn9xg=6mKcqsXK2kKQ@mail.gmail.com> (raw)
In-Reply-To: <f5ceabb5-071c-7305-83b3-3b268665e60c@codesourcery.com>
On Mon, Feb 13, 2017 at 10:43 AM, Luis Machado
<lgustavo@codesourcery.com> wrote:
> On 01/18/2017 05:50 PM, Max Filippov wrote:
>>
>> Correctly handle a0- registers on requests from remote gdb. This fixes
>>
>> 'Register 1 is not available'
>>
>> and subsequent assertion in the remote gdb connecting to the gdbserver:
>>
>> 'findvar.c:291: internal-error: value_of_register_lazy:
>> Assertion `frame_id_p(get_frame_id (frame))' failed.'
>>
>> The register structure is the same for windowed and call0 ABIs because
>> currently linux kernel internally requires windowed registers, so they
>> are always present.
>>
>> 2017-01-18 Max Filippov <jcmvbkbc@gmail.com>
>> gdb/gdbserver/
>
>
> Drop gdb/gdbserver/
>
>> * linux-xtensa-low.c (C0_NREGS): New definition.
>> (xtensa_fill_gregset): Call collect_register for all registers in
>> a0_regnum..a0_regnum + C0_NREGS range.
>> (xtensa_store_gregset): Call supply_register for all registers in
>> a0_regnum..a0_regnum + C0_NREGS range.
>> ---
>> gdb/gdbserver/linux-xtensa-low.c | 26 ++++++++++++++++++++++++++
>> 1 file changed, 26 insertions(+)
>>
>> diff --git a/gdb/gdbserver/linux-xtensa-low.c
>> b/gdb/gdbserver/linux-xtensa-low.c
>> index 98c0bf2..73fbfe2 100644
>> --- a/gdb/gdbserver/linux-xtensa-low.c
>> +++ b/gdb/gdbserver/linux-xtensa-low.c
>> @@ -39,12 +39,15 @@ enum regnum {
>> R_A0 = 64
>> };
>>
>> +#define C0_NREGS 16
>> +
>
>
> This is duplicating code from gdb/xtensa-linux-nat. Common nat code could be
> added to gdb/nat/ in an xtensa-specific file.
Ok.
>> static void
>> xtensa_fill_gregset (struct regcache *regcache, void *buf)
>> {
>> elf_greg_t* rset = (elf_greg_t*)buf;
>> const struct target_desc *tdesc = regcache->tdesc;
>> int ar0_regnum;
>> + int a0_regnum;
>> char *ptr;
>> int i;
>>
>> @@ -72,6 +75,17 @@ xtensa_fill_gregset (struct regcache *regcache, void
>> *buf)
>> collect_register_by_name (regcache, "ps", (char*)&rset[R_PS]);
>> collect_register_by_name (regcache, "windowbase", (char*)&rset[R_WB]);
>> collect_register_by_name (regcache, "windowstart", (char*)&rset[R_WS]);
>> +
>> + a0_regnum = find_regno (tdesc, "a0");
>> + ptr = (char *)&rset[R_A0 + 4 * rset[R_WB]];
>
>
> (char *) &rset... with space.
>
> More occurrences of this below.
Will fix.
>> +
>> + for (i = a0_regnum; i < a0_regnum + C0_NREGS; i++)
>> + {
>> + if (4 * rset[R_WB] + i - a0_regnum == XCHAL_NUM_AREGS)
>
>
> This looks slightly error-prone. Adding parenthesis around the expression
> would look better and avoid compiler warnings.
Will add. It builds without warnings for me though.
>> + ptr = (char *)&rset[R_A0];
>
>
> space issue mentioned above.
Will fix.
>> + collect_register (regcache, i, ptr);
>> + ptr += register_size (tdesc, i);
>> + }
>> }
>>
>> static void
>> @@ -80,6 +94,7 @@ xtensa_store_gregset (struct regcache *regcache, const
>> void *buf)
>> const elf_greg_t* rset = (const elf_greg_t*)buf;
>> const struct target_desc *tdesc = regcache->tdesc;
>> int ar0_regnum;
>> + int a0_regnum;
>> char *ptr;
>> int i;
>>
>> @@ -94,6 +109,17 @@ xtensa_store_gregset (struct regcache *regcache, const
>> void *buf)
>> ptr += register_size (tdesc, i);
>> }
>>
>> + a0_regnum = find_regno (tdesc, "a0");
>> + ptr = (char *)&rset[R_A0 + (4 * rset[R_WB]) % XCHAL_NUM_AREGS];
>> +
>
>
> space issue.
Will fix.
>> + for (i = a0_regnum; i < a0_regnum + C0_NREGS; i++)
>> + {
>> + if (4 * rset[R_WB] + i - a0_regnum == XCHAL_NUM_AREGS)
>
>
> parenthesis around the expression.
Will add.
--
Thanks.
-- Max
next prev parent reply other threads:[~2017-02-14 10:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 23:51 [PATCH 0/3] xtensa: support call0 ABI native linux gdb and gdbserver Max Filippov
2017-01-18 23:51 ` [PATCH 1/3] gdb: xtensa: initialize isa in call0_ret Max Filippov
2017-02-13 18:33 ` Luis Machado
2017-02-14 9:46 ` Max Filippov
2017-01-18 23:51 ` [PATCH 2/3] gdb: xtensa-linux: add call0 support Max Filippov
2017-02-13 18:37 ` Luis Machado
2017-01-18 23:51 ` [PATCH 3/3] gdbserver: xtensa: " Max Filippov
2017-02-13 18:43 ` Luis Machado
2017-02-14 10:04 ` Max Filippov [this message]
2017-01-26 19:11 ` [PATCH 0/3] xtensa: support call0 ABI native linux gdb and gdbserver 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='CAMo8BfK8kr9AmVzZj+=PrRXOZxQpkBgVGn9xg=6mKcqsXK2kKQ@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).