Index: gdb/gdbserver/spu-low.c |
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c |
index d7283a9703f90d215ec1aa4f8181a5e5df158a43..49b02a641f01333d988cfd50c8fba5058c44470c 100644 |
--- a/gdb/gdbserver/spu-low.c |
+++ b/gdb/gdbserver/spu-low.c |
@@ -1,5 +1,5 @@ |
/* Low level interface to SPUs, for the remote server for GDB. |
- Copyright (C) 2006-2012 Free Software Foundation, Inc. |
+ Copyright (C) 2006-2013 Free Software Foundation, Inc. |
Contributed by Ulrich Weigand <uweigand@de.ibm.com>. |
@@ -20,7 +20,7 @@ |
#include "server.h" |
-#include <sys/wait.h> |
+#include "gdb_wait.h" |
#include <stdio.h> |
#include <sys/ptrace.h> |
#include <fcntl.h> |
@@ -29,6 +29,8 @@ |
#include <unistd.h> |
#include <errno.h> |
#include <sys/syscall.h> |
+#include "filestuff.h" |
+#include "hostio.h" |
/* Some older glibc versions do not define this. */ |
#ifndef __WNOTHREAD |
@@ -51,15 +53,12 @@ |
#define INSTR_SC 0x44000002 |
#define NR_spu_run 0x0116 |
-/* Get current thread ID (Linux task ID). */ |
-#define current_ptid ((struct inferior_list_entry *)current_inferior)->id |
- |
/* These are used in remote-utils.c. */ |
int using_threads = 0; |
/* Defined in auto-generated file reg-spu.c. */ |
void init_registers_spu (void); |
- |
+extern const struct target_desc *tdesc_spu; |
/* Fetch PPU register REGNO. */ |
static CORE_ADDR |
@@ -269,6 +268,7 @@ spu_create_inferior (char *program, char **allargs) |
{ |
int pid; |
ptid_t ptid; |
+ struct process_info *proc; |
pid = fork (); |
if (pid < 0) |
@@ -276,6 +276,7 @@ spu_create_inferior (char *program, char **allargs) |
if (pid == 0) |
{ |
+ close_most_fds (); |
ptrace (PTRACE_TRACEME, 0, 0, 0); |
setpgid (0, 0); |
@@ -290,7 +291,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); |
@@ -302,6 +304,7 @@ int |
spu_attach (unsigned long pid) |
{ |
ptid_t ptid; |
+ struct process_info *proc; |
if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0) |
{ |
@@ -311,7 +314,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; |