This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] spu: Use ptid from regcache instead of inferior_ptid
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 20 Mar 2017 22:24:41 -0000
- Subject: [binutils-gdb] spu: Use ptid from regcache instead of inferior_ptid
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=639a9038c9f4fc50b6a57c18fe84db4559367a96
commit 639a9038c9f4fc50b6a57c18fe84db4559367a96
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Mon Mar 20 18:23:47 2017 -0400
spu: Use ptid from regcache instead of inferior_ptid
The implementations of to_fetch_registers/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.
gdb/ChangeLog:
* 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.
Diff:
---
gdb/ChangeLog | 8 ++++++++
gdb/spu-linux-nat.c | 10 ++++++++++
gdb/spu-multiarch.c | 10 ++++++++++
3 files changed, 28 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 70d48a5..02ab32c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2017-03-20 Simon Marchi <simon.marchi@polymtl.ca>
+ * 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.
+
+2017-03-20 Simon Marchi <simon.marchi@polymtl.ca>
+
* i386-linux-nat.c (fetch_register, store_register,
i386_linux_fetch_inferior_registers,
i386_linux_store_inferior_registers): Use ptid from regcache.
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index c5b9122..19552fc 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -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;
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index b99a1a3..abc4653 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -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)
{