aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-07-23 03:52:15 +0000
committerDaniel Jacobowitz <drow@false.org>2006-07-23 03:52:15 +0000
commitb80864fbe54e0280d6cd040b0ede0568dd66d90f (patch)
treecd09718cd52c0dd8bdfe7e6cf2bfad8217dfa674 /gdb/gdbserver/server.c
parent66a79c16a65742d14f5991b596541276245d24ba (diff)
downloadgdb-b80864fbe54e0280d6cd040b0ede0568dd66d90f.zip
gdb-b80864fbe54e0280d6cd040b0ede0568dd66d90f.tar.gz
gdb-b80864fbe54e0280d6cd040b0ede0568dd66d90f.tar.bz2
gdb/
* configure.tgt: Build gdbserver for Cygwin and mingw32. gdb/gdbserver/ * configure.ac: Check for more headers which are missing on Windows. Automatically supply -lwsock32 and USE_WIN32API. * configure.srv: Add Cygwin and mingw32. * remote-utils.c: Don't include headers unconditionally which are missing on mingw32. Include <winsock.h> for mingw32. (remote_open): Adjust for mingw32 support. Flush standard error after writing to it. (remote_close, putpkt_binary, input_interrupt, block_async_io) (unblock_async_io, enable_async_io, disable_async_io) (readchar, getpkt): Update for Winsock support. (prepare_resume_reply): Expect a protocol signal number. * server.c: Disable <sys/wait.h> on mingw32. (start_inferior): Adjust for mingw32 support. Flush standard error after writing to it. (attach_inferior): Likewise. Use protocol signal numbers. (main): Skip 'D' packet on mingw32. Use protocol signal numbers and names. * win32-i386-low.c: New file. * Makefile.in (XM_CLIBS): Set. (gdbserver, gdbreplay): Use $(INTERNAL_CFLAGS). (win32-i386-low.o): New dependency rule. * linux-low.c (linux_wait): Use target signal numbers. * target.h (struct target_ops): Doc fix. * server.h (target_signal_to_name): New prototype. * gdbreplay.c: Don't include headers unconditionally which are missing on mingw32. Include <winsock.h> for mingw32. (remote_close, remote_open): Adjust for Winsock support. * configure, config.in: Regenerated.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 4b8120a..854e2b1 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -24,7 +24,9 @@
#include <unistd.h>
#include <signal.h>
+#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
unsigned long cont_thread;
unsigned long general_thread;
@@ -46,17 +48,22 @@ unsigned long signal_pid;
static int
start_inferior (char *argv[], char *statusptr)
{
+#ifdef SIGTTOU
signal (SIGTTOU, SIG_DFL);
signal (SIGTTIN, SIG_DFL);
+#endif
signal_pid = create_inferior (argv[0], argv);
fprintf (stderr, "Process %s created; pid = %ld\n", argv[0],
signal_pid);
+ fflush (stderr);
+#ifdef SIGTTOU
signal (SIGTTOU, SIG_IGN);
signal (SIGTTIN, SIG_IGN);
tcsetpgrp (fileno (stderr), signal_pid);
+#endif
/* Wait till we are at 1st instruction in program, return signal number. */
return mywait (statusptr, 0);
@@ -72,6 +79,7 @@ attach_inferior (int pid, char *statusptr, int *sigptr)
return -1;
fprintf (stderr, "Attached; pid = %d\n", pid);
+ fflush (stderr);
/* FIXME - It may be that we should get the SIGNAL_PID from the
attach function, so that it can be the main thread instead of
@@ -83,8 +91,8 @@ attach_inferior (int pid, char *statusptr, int *sigptr)
/* GDB knows to ignore the first SIGSTOP after attaching to a running
process using the "attach" command, but this is different; it's
just using "target remote". Pretend it's just starting up. */
- if (*statusptr == 'T' && *sigptr == SIGSTOP)
- *sigptr = SIGTRAP;
+ if (*statusptr == 'T' && *sigptr == TARGET_SIGNAL_STOP)
+ *sigptr = TARGET_SIGNAL_TRAP;
return 0;
}
@@ -516,6 +524,9 @@ main (int argc, char *argv[])
case 'd':
remote_debug = !remote_debug;
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 ();
@@ -537,6 +548,7 @@ main (int argc, char *argv[])
}
exit (0);
+#endif
case '!':
if (attached == 0)
@@ -794,8 +806,9 @@ main (int argc, char *argv[])
fprintf (stderr,
"\nChild exited with status %d\n", signal);
if (status == 'X')
- fprintf (stderr, "\nChild terminated with signal = 0x%x\n",
- signal);
+ fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
+ target_signal_to_host (signal),
+ target_signal_to_name (signal));
if (status == 'W' || status == 'X')
{
if (extended_protocol)