[v2,2/3] spu: Use ptid from regcache instead of inferior_ptid
Commit Message
From: Simon Marchi <simon.marchi@polymtl.ca>
New in v2: use scoped_restore to save/restore inferior_ptid.
The implementations of to_fetch_regiters/to_store_registers in the spu
code use some functions that rely on inferior_ptid. It's simpler for
now to set/restore inferior_ptid.
* spu-linux-nat.c (spu_fetch_inferior_registers,
spu_store_inferior_registers): Use ptid from regcache, set and
restore inferior_ptid.
* spu-multiarch.c (spu_fetch_registers, spu_store_registers):
Likewise.
---
gdb/spu-linux-nat.c | 10 ++++++++++
gdb/spu-multiarch.c | 10 ++++++++++
2 files changed, 20 insertions(+)
Comments
On 03/20/2017 09:51 PM, Simon Marchi wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> New in v2: use scoped_restore to save/restore inferior_ptid.
>
> The implementations of to_fetch_regiters/to_store_registers in the spu
Typo: "regiters".
> code use some functions that rely on inferior_ptid. It's simpler for
> now to set/restore inferior_ptid.
>
> * spu-linux-nat.c (spu_fetch_inferior_registers,
> spu_store_inferior_registers): Use ptid from regcache, set and
> restore inferior_ptid.
> * spu-multiarch.c (spu_fetch_registers, spu_store_registers):
> Likewise.
LGTM.
Thanks,
Pedro Alves
On 2017-03-20 18:06, Pedro Alves wrote:
> On 03/20/2017 09:51 PM, Simon Marchi wrote:
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>
>> New in v2: use scoped_restore to save/restore inferior_ptid.
>>
>> The implementations of to_fetch_regiters/to_store_registers in the spu
>
> Typo: "regiters".
Oops, fixed.
>> code use some functions that rely on inferior_ptid. It's simpler for
>> now to set/restore inferior_ptid.
>>
>> * spu-linux-nat.c (spu_fetch_inferior_registers,
>> spu_store_inferior_registers): Use ptid from regcache, set and
>> restore inferior_ptid.
>> * spu-multiarch.c (spu_fetch_registers, spu_store_registers):
>> Likewise.
>
> LGTM.
Thanks, pushed.
Simon
@@ -492,6 +492,11 @@ 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. */
+ scoped_restore save_ptid
+ = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache));
+
/* We must be stopped on a spu_run system call. */
if (!parse_spufs_run (&fd, &addr))
return;
@@ -539,6 +544,11 @@ spu_store_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. */
+ scoped_restore save_ptid
+ = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache));
+
/* We must be stopped on a spu_run system call. */
if (!parse_spufs_run (&fd, &addr))
return;
@@ -149,6 +149,11 @@ spu_fetch_registers (struct target_ops *ops,
int spufs_fd;
CORE_ADDR spufs_addr;
+ /* Since we use functions that rely on inferior_ptid, we need to set and
+ restore it. */
+ scoped_restore save_ptid
+ = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache));
+
/* This version applies only if we're currently in spu_run. */
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
{
@@ -203,6 +208,11 @@ spu_store_registers (struct target_ops *ops,
int spufs_fd;
CORE_ADDR spufs_addr;
+ /* Since we use functions that rely on inferior_ptid, we need to set and
+ restore it. */
+ scoped_restore save_ptid
+ = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache));
+
/* This version applies only if we're currently in spu_run. */
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
{