From: Maxim Grigoriev <maxim@tensilica.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: Markus Deuling <deuling@de.ibm.com>,
GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [rfc] [05/05] Get rid of current_gdbarch in xtensa
Date: Fri, 09 Nov 2007 02:12:00 -0000 [thread overview]
Message-ID: <4733C204.9040005@hq.tensilica.com> (raw)
In-Reply-To: <200711082155.lA8LtPjO001820@d12av02.megacenter.de.ibm.com>
Ulrich Weigand wrote:
> Markus Deuling wrote:
>
>> -#define AREG_NUMBER(r, wb) \
>> - ((((r) - (gdbarch_tdep (current_gdbarch)->a0_base + 0) + (((wb) \
>> - & ((gdbarch_tdep (current_gdbarch)->num_aregs - 1) >> 2)) << WB_SHIFT)) & \
>> - (gdbarch_tdep (current_gdbarch)->num_aregs - 1)) \
>> - + gdbarch_tdep (current_gdbarch)->ar_base)
>>
>> +/* Convert a live Ax register number to the corresponding Areg number. */
>> +static int
>> +areg_number (struct gdbarch *gdbarch, int regnum, ULONGEST wb)
>> +{
>> + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
>> + int areg;
>> +
>> + areg = regnum - tdep->a0_base + tdep->ar_base;
>> + areg += (wb & ((tdep->num_aregs - 1) >> 2)) << WB_SHIFT;
>> + areg &= tdep->num_aregs - 1;
>> +
>> + return areg;
>> +}
>>
>
> The function does not look equivalent to the macro, that should be
>
> areg = regnum - tdep->a0_base;
> areg += (wb & ((tdep->num_aregs - 1) >> 2)) << WB_SHIFT;
> areg &= tdep->num_aregs - 1;
>
> return areg + tdep->ar_base;
>
Ulrich is right. The function should look like he suggested :
static int
areg_number (struct gdbarch *gdbarch, int regnum, ULONGEST wb)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int areg;
areg = regnum - tdep->a0_base;
areg += (wb & ((tdep->num_aregs - 1) >> 2)) << WB_SHIFT;
areg &= tdep->num_aregs - 1;
return areg + tdep->ar_base;
}
I applied Markus's patch, corrected areg_number(), and ran GDB dejagnu
tests.
No regression has been detected.
-- Maxim
next prev parent reply other threads:[~2007-11-09 2:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-07 11:13 Markus Deuling
2007-11-08 21:55 ` Ulrich Weigand
2007-11-08 22:18 ` Daniel Jacobowitz
2007-11-08 22:30 ` Maxim Grigoriev
2007-11-09 2:12 ` Maxim Grigoriev [this message]
2007-11-09 5:59 ` Markus Deuling
2007-11-09 7:47 ` Maxim Grigoriev
2007-11-09 13:13 ` Ulrich Weigand
2007-11-12 6:44 ` Markus Deuling
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=4733C204.9040005@hq.tensilica.com \
--to=maxim@tensilica.com \
--cc=deuling@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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