summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2007-02-05 20:46:05 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2007-02-05 20:46:05 +0000
commitc636bb66cc9043032caf20cb067bf9c818b7d17e (patch)
tree51cbf84685276b0433ce1548a55fa9bda65ee880 /vl.c
parent84f2e8ef058f5919f0e896d48edecc4c1282e092 (diff)
downloadqemu-c636bb66cc9043032caf20cb067bf9c818b7d17e.tar.gz
qemu-c636bb66cc9043032caf20cb067bf9c818b7d17e.tar.bz2
qemu-c636bb66cc9043032caf20cb067bf9c818b7d17e.zip
gdbserver fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2393 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/vl.c b/vl.c
index c05def228e..1757036c05 100644
--- a/vl.c
+++ b/vl.c
@@ -6499,8 +6499,7 @@ static BOOL WINAPI qemu_ctrl_handler(DWORD type)
int main(int argc, char **argv)
{
#ifdef CONFIG_GDBSTUB
- int use_gdbstub;
- char gdbstub_port_name[128];
+ int use_gdbstub, gdbstub_port;
#endif
int i, cdrom_index;
int snapshot, linux_boot;
@@ -6568,7 +6567,7 @@ int main(int argc, char **argv)
bios_size = BIOS_SIZE;
#ifdef CONFIG_GDBSTUB
use_gdbstub = 0;
- sprintf(gdbstub_port_name, "%d", DEFAULT_GDBSTUB_PORT);
+ gdbstub_port = DEFAULT_GDBSTUB_PORT;
#endif
snapshot = 0;
nographic = 0;
@@ -6812,7 +6811,7 @@ int main(int argc, char **argv)
use_gdbstub = 1;
break;
case QEMU_OPTION_p:
- pstrcpy(gdbstub_port_name, sizeof(gdbstub_port_name), optarg);
+ gdbstub_port = atoi(optarg);
break;
#endif
case QEMU_OPTION_L:
@@ -7220,19 +7219,13 @@ int main(int argc, char **argv)
#ifdef CONFIG_GDBSTUB
if (use_gdbstub) {
- CharDriverState *chr;
- int port;
-
- port = atoi(gdbstub_port_name);
- if (port != 0)
- sprintf(gdbstub_port_name, "tcp::%d,nowait,nodelay,server", port);
- chr = qemu_chr_open(gdbstub_port_name);
- if (!chr) {
- fprintf(stderr, "qemu: could not open gdbstub device '%s'\n",
- gdbstub_port_name);
+ /* XXX: use standard host:port notation and modify options
+ accordingly. */
+ if (gdbserver_start_port(gdbstub_port) < 0) {
+ fprintf(stderr, "qemu: could not open gdbstub device on port '%d'\n",
+ gdbstub_port);
exit(1);
}
- gdbserver_start(chr);
} else
#endif
if (loadvm)