[PATCH 2/3] spu: Use ptid from regcache instead of inferior_ptid

Simon Marchi simon.marchi@polymtl.ca
Mon Mar 20 21:50:00 GMT 2017


On 2017-03-20 11:54, Pedro Alves wrote:
> On 03/18/2017 05:08 PM, Simon Marchi wrote:
>> --- a/gdb/spu-linux-nat.c
>> +++ b/gdb/spu-linux-nat.c
>> @@ -492,9 +492,17 @@ spu_fetch_inferior_registers (struct target_ops 
>> *ops,
>>    int fd;
>>    ULONGEST addr;
>> 
>> +  /* Since we use functions that rely on inferior_ptid, we need to 
>> set and
>> +     restore it.  */
>> +  struct cleanup *cleanup = save_inferior_ptid ();
>> +  inferior_ptid = regcache_get_ptid (regcache);
>> +
> 
> Use a scoped_restore for all these?  Like:
> 
>   scoped_restore save_ptid = make_scoped_restore (&inferior_ptid,
> 						  regcache_get_ptid (regcache));

Good point.  I almost made an RAII equivalent of save_inferior_ptid, but 
then decided against it, based on the fact that we don't want to 
encourage people to use it :).  But a scoped_restore is a better choice 
in any case.  I'll send an updated patch.

Thanks,

Simon



More information about the Gdb-patches mailing list