aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/spu-low.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-04-01 22:31:45 +0000
committerPedro Alves <palves@redhat.com>2009-04-01 22:31:45 +0000
commit5b1c542ea1c4ff247db390bd24a9e0665d0c2e48 (patch)
tree0596b3d42d4fdcbe13c72e148774b85d1795ff13 /gdb/gdbserver/spu-low.c
parent2bd7c093f663139ad9e57ddc748ade12f6bfbe01 (diff)
downloadgdb-5b1c542ea1c4ff247db390bd24a9e0665d0c2e48.zip
gdb-5b1c542ea1c4ff247db390bd24a9e0665d0c2e48.tar.gz
gdb-5b1c542ea1c4ff247db390bd24a9e0665d0c2e48.tar.bz2
Decouple target code from remote protocol.
* target.h (enum target_waitkind): New. (struct target_waitstatus): New. (struct target_ops) <wait>: Return an unsigned long. Take a target_waitstatus pointer instead of a char pointer. (mywait): Likewise. * target.c (mywait): Change prototype to return an unsigned long. Take a target_waitstatus pointer instead of a char pointer. Adjust. * server.h (thread_from_wait, old_thread_from_wait): Delete declarations. (prepare_resume_reply): Change prototype to take a target_waitstatus. * server.c (thread_from_wait, old_thread_from_wait): Delete. (last_status, last_ptid): New. (start_inferior): Remove "statusptr" argument. Adjust. Return a pid instead of a signal. (attach_inferior): Remove "status" and "signal" parameters. Adjust. (handle_query): For qGetTLSAddr, parse the thread id with strtol, not as an address. (handle_v_cont, handle_v_attach, handle_v_run, handle_v_kill) (handle_v_requests, myresume): Remove "status" and "signal" parameters. Adjust. (handle_status): New. (main): Delete local `status'. Adjust. * remote-utils.c: Include target.h. (prepare_resume_reply): Change prototype to take a target_waitstatus. Adjust. * linux-low.c (linux_wait): Adjust to new target_ops->wait interface. * spu-low.c (spu_wait): Adjust. * win32-low.c (enum target_waitkind, struct target_waitstatus): Delete. (win32_wait): Adjust.
Diffstat (limited to 'gdb/gdbserver/spu-low.c')
-rw-r--r--gdb/gdbserver/spu-low.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 792241c..d0ff22c 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -371,8 +371,8 @@ spu_resume (struct thread_resume *resume_info, size_t n)
}
/* Wait for process, returns status. */
-static unsigned char
-spu_wait (char *status)
+static unsigned long
+spu_wait (struct target_waitstatus *ourstatus)
{
int tid = current_tid;
int w;
@@ -407,31 +407,37 @@ spu_wait (char *status)
}
}
+ ret = current_tid;
+
if (WIFEXITED (w))
{
fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
- *status = 'W';
+ ourstatus->kind = TARGET_WAITKIND_EXITED;
+ ourstatus->value.integer = WEXITSTATUS (w);
clear_inferiors ();
- return ((unsigned char) WEXITSTATUS (w));
+ return ret;
}
else if (!WIFSTOPPED (w))
{
fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
- *status = 'X';
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = target_signal_from_host (WTERMSIG (w));
clear_inferiors ();
- return ((unsigned char) WTERMSIG (w));
+ return ret;
}
/* After attach, we may have received a SIGSTOP. Do not return this
as signal to GDB, or else it will try to continue with SIGSTOP ... */
if (!server_waiting)
{
- *status = 'T';
- return 0;
+ ourstatus->kind = TARGET_WAITKIND_STOPPED;
+ ourstatus->value.sig = TARGET_SIGNAL_0;
+ return ret;
}
- *status = 'T';
- return ((unsigned char) WSTOPSIG (w));
+ ourstatus->kind = TARGET_WAITKIND_STOPPED;
+ ourstatus->value.sig = target_signal_from_host (WSTOPSIG (w));
+ return ret;
}
/* Fetch inferior registers. */