summaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-02-22 01:48:01 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-02-22 01:48:01 +0000
commitcfc3475a8df6d03dfbffa813d7d919eda409c85b (patch)
treee674005120c69bba0ae2402fd05aec1c923a4f49 /gdbstub.c
parent7bcc17dc020d49f0baf25010f3d2be41ebfe238f (diff)
Allow gdbstub to connect over any serial device.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2448 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/gdbstub.c b/gdbstub.c
index aeddc3474..324af4d19 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1216,10 +1216,26 @@ static void gdb_chr_event(void *opaque, int event)
}
}
-int gdbserver_start(CharDriverState *chr)
+int gdbserver_start(const char *port)
{
GDBState *s;
+ char gdbstub_port_name[128];
+ int port_num;
+ char *p;
+ CharDriverState *chr;
+
+ if (!port || !*port)
+ return -1;
+ port_num = strtol(port, &p, 10);
+ if (*p == 0) {
+ /* A numeric value is interpreted as a port number. */
+ snprintf(gdbstub_port_name, sizeof(gdbstub_port_name),
+ "tcp::%d,nowait,nodelay,server", port_num);
+ port = gdbstub_port_name;
+ }
+
+ chr = qemu_chr_open(port);
if (!chr)
return -1;
@@ -1234,18 +1250,4 @@ int gdbserver_start(CharDriverState *chr)
qemu_add_vm_stop_handler(gdb_vm_stopped, s);
return 0;
}
-
-int gdbserver_start_port(int port)
-{
- CharDriverState *chr;
- char gdbstub_port_name[128];
-
- snprintf(gdbstub_port_name, sizeof(gdbstub_port_name),
- "tcp::%d,nowait,nodelay,server", port);
- chr = qemu_chr_open(gdbstub_port_name);
- if (!chr)
- return -EIO;
- return gdbserver_start(chr);
-}
-
#endif