* [Qemu-devel] gdb-stub support for Win32 host
@ 2006-05-27 15:11 Jason Wessel
2006-05-31 4:20 ` Kazu
0 siblings, 1 reply; 2+ messages in thread
From: Jason Wessel @ 2006-05-27 15:11 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 241 bytes --]
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: jason.wessel@windriver.com
Thanks,
Jason.
[-- Attachment #2: gdb-stub-win32.patch --]
[-- Type: text/plain, Size: 2840 bytes --]
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] gdb-stub support for Win32 host
2006-05-27 15:11 [Qemu-devel] gdb-stub support for Win32 host Jason Wessel
@ 2006-05-31 4:20 ` Kazu
0 siblings, 0 replies; 2+ messages in thread
From: Kazu @ 2006-05-31 4:20 UTC (permalink / raw)
To: qemu-devel
Sent: Sunday, May 28, 2006 12:11 AM Jason Wessel wrote:
>
> 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.
>
I works fine. Thank you.
Regards,
Kazu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-31 4:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-27 15:11 [Qemu-devel] gdb-stub support for Win32 host Jason Wessel
2006-05-31 4:20 ` Kazu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).