aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2007-05-10 21:05:15 +0000
committerPedro Alves <palves@redhat.com>2007-05-10 21:05:15 +0000
commit444d61395b63ff0474e8d150497ac709cf6702f6 (patch)
tree5cd2142151c86c22047df4e3095d3ba89bd96503 /gdb/gdbserver/server.c
parent1d5315fee9335ecba7d345e41e451caa1d604114 (diff)
downloadfsf-binutils-gdb-444d61395b63ff0474e8d150497ac709cf6702f6.zip
fsf-binutils-gdb-444d61395b63ff0474e8d150497ac709cf6702f6.tar.gz
fsf-binutils-gdb-444d61395b63ff0474e8d150497ac709cf6702f6.tar.bz2
* target.h (target_ops): Change return type of detach to int.
Add join. (join_inferior): New. * server.c (main): Don't skip detach support on mingw32. If the inferior doesn't support detaching return error. Call join_inferior instead of using waitpid. * linux-low.c (linux_join): New. (linux_target_op): Add linux_join. * spu-low.c (spu_join): New. (spu_target_ops): Add spu_join. * win32-low.c (win32_detach): Adapt to new interface. Reopen current_process_handle before detaching. Issue a child resume before detaching. (win32_join): New. (win32_target_op): Add win32_join.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 61a08a1..ca18a1d 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -805,32 +805,27 @@ main (int argc, char *argv[])
case 'Q':
handle_general_set (own_buf);
break;
-#ifndef USE_WIN32API
- /* Skip "detach" support on mingw32, since we don't have
- waitpid. */
case 'D':
fprintf (stderr, "Detaching from inferior\n");
- detach_inferior ();
- write_ok (own_buf);
- putpkt (own_buf);
- remote_close ();
-
- /* If we are attached, then we can exit. Otherwise, we need to
- hang around doing nothing, until the child is gone. */
- if (!attached)
+ if (detach_inferior () != 0)
{
- int status, ret;
-
- do {
- ret = waitpid (signal_pid, &status, 0);
- if (WIFEXITED (status) || WIFSIGNALED (status))
- break;
- } while (ret != -1 || errno != ECHILD);
+ write_enn (own_buf);
+ putpkt (own_buf);
}
+ else
+ {
+ write_ok (own_buf);
+ putpkt (own_buf);
+ remote_close ();
- exit (0);
-#endif
+ /* If we are attached, then we can exit. Otherwise, we
+ need to hang around doing nothing, until the child
+ is gone. */
+ if (!attached)
+ join_inferior ();
+ exit (0);
+ }
case '!':
if (attached == 0)
{