From: Jason Wessel <jason.wessel@windriver.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] gdb-stub support for Win32 host
Date: Sat, 27 May 2006 10:11:45 -0500 [thread overview]
Message-ID: <44786C31.6060200@windriver.com> (raw)
[-- 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;
}
next reply other threads:[~2006-05-27 15:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-27 15:11 Jason Wessel [this message]
2006-05-31 4:20 ` [Qemu-devel] gdb-stub support for Win32 host Kazu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44786C31.6060200@windriver.com \
--to=jason.wessel@windriver.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).