aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/win32-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/win32-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/win32-low.c')
-rw-r--r--gdb/gdbserver/win32-low.c69
1 files changed, 14 insertions, 55 deletions
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 7c63ff4..2fed73c 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -241,45 +241,6 @@ child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
return done;
}
-/* Generally, what has the program done? */
-enum target_waitkind
-{
- /* The program has exited. The exit status is in value.integer. */
- TARGET_WAITKIND_EXITED,
-
- /* The program has stopped with a signal. Which signal is in
- value.sig. */
- TARGET_WAITKIND_STOPPED,
-
- /* The program is letting us know that it dynamically loaded
- or unloaded something. */
- TARGET_WAITKIND_LOADED,
-
- /* The program has exec'ed a new executable file. The new file's
- pathname is pointed to by value.execd_pathname. */
- TARGET_WAITKIND_EXECD,
-
- /* Nothing interesting happened, but we stopped anyway. We take the
- chance to check if GDB requested an interrupt. */
- TARGET_WAITKIND_SPURIOUS,
-};
-
-struct target_waitstatus
-{
- enum target_waitkind kind;
-
- /* Forked child pid, execd pathname, exit status or signal number. */
- union
- {
- int integer;
- enum target_signal sig;
- int related_pid;
- char *execd_pathname;
- int syscall_id;
- }
- value;
-};
-
/* Clear out any old thread list and reinitialize it to a pristine
state. */
static void
@@ -1514,37 +1475,30 @@ get_child_debug_event (struct target_waitstatus *ourstatus)
/* Wait for the inferior process to change state.
STATUS will be filled in with a response code to send to GDB.
Returns the signal which caused the process to stop. */
-static unsigned char
-win32_wait (char *status)
+static unsigned long
+win32_wait (struct target_waitstatus *ourstatus)
{
- struct target_waitstatus our_status;
-
- *status = 'T';
-
while (1)
{
- if (!get_child_debug_event (&our_status))
+ if (!get_child_debug_event (ourstatus))
continue;
- switch (our_status.kind)
+ switch (ourstatus->kind)
{
case TARGET_WAITKIND_EXITED:
OUTMSG2 (("Child exited with retcode = %x\n",
- our_status.value.integer));
+ ourstatus->value.integer));
- *status = 'W';
win32_clear_inferiors ();
- return our_status.value.integer;
+ return current_event.dwProcessId;
case TARGET_WAITKIND_STOPPED:
case TARGET_WAITKIND_LOADED:
OUTMSG2 (("Child Stopped with signal = %d \n",
our_status.value.sig));
- *status = 'T';
-
child_fetch_inferior_registers (-1);
- if (our_status.kind == TARGET_WAITKIND_LOADED
+ if (ourstatus->kind == TARGET_WAITKIND_LOADED
&& !server_waiting)
{
/* When gdb connects, we want to be stopped at the
@@ -1553,9 +1507,14 @@ win32_wait (char *status)
break;
}
- return our_status.value.sig;
+ /* We don't expose _LOADED events to gdbserver core. See
+ the `dlls_changed' global. */
+ if (ourstatus->kind == TARGET_WAITKIND_LOADED)
+ ourstatus->kind = TARGET_WAITKIND_STOPPED;
+
+ return current_event.dwThreadId;
default:
- OUTMSG (("Ignoring unknown internal event, %d\n", our_status.kind));
+ OUTMSG (("Ignoring unknown internal event, %d\n", ourstatus->kind));
/* fall-through */
case TARGET_WAITKIND_SPURIOUS:
case TARGET_WAITKIND_EXECD: