[rfc] [05/05] Get rid of current_gdbarch in xtensa

Markus Deuling deuling@de.ibm.com
Fri Nov 9 05:59:00 GMT 2007


Maxim Grigoriev schrieb:
> 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

Uli,
Maxim,

thank you very much for your review and test. I changed areg_number like suggested. Attached
is the new version of the patch. ChangeLog stays the same.

Ok to commit?


-- 
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-xtensa
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20071109/4f9e0fd1/attachment.ksh>


More information about the Gdb-patches mailing list