This patch adds support for the gdb-stub to work on the Win32 host and compile in by default. I retested to make sure everything was compatible so as not to break the unix side.
signed-off-by: [EMAIL PROTECTED] Thanks, Jason.
Index: qemu/configure =================================================================== --- qemu.orig/configure +++ qemu/configure @@ -312,7 +312,6 @@ fi if test "$mingw32" = "yes" ; then linux="no" EXESUF=".exe" - gdbstub="no" oss="no" if [ "$cpu" = "i386" ] ; then kqemu="yes" Index: qemu/gdbstub.c =================================================================== --- qemu.orig/gdbstub.c +++ qemu/gdbstub.c @@ -30,10 +30,22 @@ #include "vl.h" #endif +#ifndef _WIN32 #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <signal.h> +#else +#include <windows.h> +#include <io.h> +typedef unsigned int socklen_t; +#ifndef SIGTRAP +#define SIGTRAP 5 +#endif +#ifndef SIGINT +#define SIGINT 2 +#endif +#endif //#define DEBUG_GDB @@ -69,7 +81,7 @@ static int get_char(GDBState *s) int ret; for(;;) { - ret = read(s->fd, &ch, 1); + ret = recv(s->fd, &ch, 1, 0); if (ret < 0) { if (errno != EINTR && errno != EAGAIN) return -1; @@ -87,7 +99,7 @@ static void put_buffer(GDBState *s, cons int ret; while (len > 0) { - ret = write(s->fd, buf, len); + ret = send(s->fd, buf, len, 0); if (ret < 0) { if (errno != EINTR && errno != EAGAIN) return; @@ -829,7 +841,7 @@ static void gdb_read(void *opaque) int i, size; uint8_t buf[4096]; - size = read(s->fd, buf, sizeof(buf)); + size = recv(s->fd, buf, sizeof(buf), 0); if (size < 0) return; if (size == 0) { @@ -866,7 +878,7 @@ static void gdb_accept(void *opaque) /* set short latency */ val = 1; - setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); + setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); #ifdef CONFIG_USER_ONLY s = &gdbserver_state; @@ -881,7 +893,14 @@ static void gdb_accept(void *opaque) s->env = first_cpu; /* XXX: allow to change CPU */ s->fd = fd; +#ifndef _WIN32 fcntl(fd, F_SETFL, O_NONBLOCK); +#else + { + unsigned long tmp = 1; + ioctlsocket (fd, FIONBIO, &tmp); + } +#endif #ifndef CONFIG_USER_ONLY /* stop the VM */ @@ -907,7 +926,7 @@ static int gdbserver_open(int port) /* allow fast reuse */ val = 1; - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)); + setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val)); sockaddr.sin_family = AF_INET; sockaddr.sin_port = htons(port); @@ -923,7 +942,14 @@ static int gdbserver_open(int port) return -1; } #ifndef CONFIG_USER_ONLY +#ifndef _WIN32 fcntl(fd, F_SETFL, O_NONBLOCK); +#else + { + unsigned long tmp = 1; + ioctlsocket (fd, FIONBIO, &tmp); + } +#endif #endif return fd; }
_______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel