[PATCH 19/22] [GDBserver] Multi-process + multi-arch: SPU

Pedro Alves
2013-05-29T16:30:01Z

This adjusts the SPU port to new interfaces.

Built (--host=spu) on PowerPC Fedora 16. Otherwise not tested.

2013-05-29 Pedro Alves <palves@redhat.com>

* spu-low.c (tdesc_spu): Declare.
(spu_create_inferior, spu_attach): Set the new process'es tdesc.
---
gdb/gdbserver/spu-low.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index deaa115..27d3551 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -56,7 +56,7 @@ int using_threads = 0;

/* Defined in auto-generated file reg-spu.c. */
void init_registers_spu (void);
-
+extern struct target_desc *tdesc_spu;

/* Fetch PPU register REGNO. */
static CORE_ADDR
@@ -266,6 +266,7 @@ spu_create_inferior (char *program, char **allargs)
{
int pid;
ptid_t ptid;
+ struct process_info *proc;

pid = fork ();
if (pid < 0)
@@ -287,7 +288,8 @@ spu_create_inferior (char *program, char **allargs)
_exit (0177);
}

- add_process (pid, 0);
+ proc = add_process (pid, 0);
+ proc->tdesc = tdesc_spu;

ptid = ptid_build (pid, pid, 0);
add_thread (ptid, NULL);
@@ -299,6 +301,7 @@ int
spu_attach (unsigned long pid)
{
ptid_t ptid;
+ struct process_info *proc;

if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0)
{
@@ -308,7 +311,8 @@ spu_attach (unsigned long pid)
_exit (0177);
}

- add_process (pid, 1);
+ proc = add_process (pid, 1);
+ proc->tdesc = tdesc_spu;
ptid = ptid_build (pid, pid, 0);
add_thread (ptid, NULL);
return 0;