Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org, Maxim Grigoriev <maxim2405@gmail.com>,
		Woody LaRue <larue@cadence.com>,
	Marc Gauthier <marc@cadence.com>
Subject: Re: [PATCH] xtensa: initialize call_abi in xtensa_tdep
Date: Thu, 20 Aug 2015 12:47:00 -0000	[thread overview]
Message-ID: <CAMo8Bf+k5hbJQ8GBKyM76mC4iq42hxtRfkb+PROtU8wh6Pm4xQ@mail.gmail.com> (raw)
In-Reply-To: <20150820120909.GC4571@adacore.com>

On Thu, Aug 20, 2015 at 3:09 PM, Joel Brobecker <brobecker@adacore.com> wrote:
> On Sun, Jun 07, 2015 at 01:05:36AM +0300, Max Filippov wrote:
>> Use XSHAL_ABI value provided by xtensa-config.h to correctly initialize
>> xtensa_tdep.call_abi
>> This fixes calls to functions from GDB that otherwise fail with the
>> following assertion in call0 configuration:
>>
>>   gdb/regcache.c:602: internal-error: regcache_raw_read: Assertion
>>   `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed.
>>
>> gdb/
>>       * xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Initialize
>>       call_abi using XSHAL_ABI macro.
>
> I am not sure I understand the patch.
>
> The first thing I should mention is that, unless what your patch
> suggests, the code as I see it on master currently initializes call_abi
> to CallAbiDefault:
>
>           .call_abi = CallAbiDefault,                           \
>
> And looking at the definitions of XSHAL_ABI and XTHAL_ABI_CALL0
> in include/xtensa-config.h, those definitions seem to be entirely
> static...
>
>     #undef XSHAL_ABI
>     #undef XTHAL_ABI_WINDOWED
>     #undef XTHAL_ABI_CALL0
>     #define XSHAL_ABI                       XTHAL_ABI_WINDOWED
>     #define XTHAL_ABI_WINDOWED              0
>     #define XTHAL_ABI_CALL0                 1
>
> ... and resolving to distinct values. So the condition would always
> be false, resulting in call_abi always being set to CallAbiDefault.
>
> Am I missing something?

The file include/xtensa-config.h is meant to be replaced by processor-specific
version where XSHAL_ABI definition may be different. That's why I mention
'call0 configuration' in the description: when xtensa core is configured without
windowed registers it will necessarily have call0 ABI.

>>  gdb/xtensa-tdep.h | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
>> index adacaf8..3b6ea66 100644
>> --- a/gdb/xtensa-tdep.h
>> +++ b/gdb/xtensa-tdep.h
>> @@ -246,7 +246,8 @@ struct gdbarch_tdep
>>         .spill_location = -1,                                 \
>>         .spill_size = (spillsz),                              \
>>         .unused = 0,                                          \
>> -       .call_abi = 0,                                        \
>> +       .call_abi = (XSHAL_ABI == XTHAL_ABI_CALL0) ?          \
>> +             CallAbiCall0Only : CallAbiDefault,              \
>
> Small style issue: binary operators should be at the start of
> the next line, rather than the end of the current line.

I'll send fixed v2.

-- 
Thanks.
-- Max


  reply	other threads:[~2015-08-20 12:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-06 22:06 Max Filippov
2015-08-20  7:38 ` Max Filippov
2015-08-20 12:09 ` Joel Brobecker
2015-08-20 12:47   ` Max Filippov [this message]
2015-08-20 12:53     ` Joel Brobecker
2015-08-20 13:00       ` 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=CAMo8Bf+k5hbJQ8GBKyM76mC4iq42hxtRfkb+PROtU8wh6Pm4xQ@mail.gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=larue@cadence.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