summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-04-06 10:47:06 +0300
committerAvi Kivity <avi@redhat.com>2009-04-06 10:47:06 +0300
commit67afa42dada0e8eab8b88bcc12447bddfccad5f7 (patch)
tree25d0be082487757dd67a932345bc293c75f87eed /gdbstub.c
parentkvm: Update .gitignore (diff)
parentRemove WIN32 guard around -k (diff)
downloadqemu-kvm-67afa42dada0e8eab8b88bcc12447bddfccad5f7.tar.gz
qemu-kvm-67afa42dada0e8eab8b88bcc12447bddfccad5f7.tar.bz2
qemu-kvm-67afa42dada0e8eab8b88bcc12447bddfccad5f7.zip
Merge commit 'qemu-svn/trunk'
* commit 'qemu-svn/trunk': (38 commits) Remove WIN32 guard around -k Add new command line option -singlestep for tcg single stepping. tcg/x86_64: optimize register allocation order stop dirty tracking just at the end of migration (Glauber Costa) create qemu_file_set_error (Glauber Costa) propagate error on failed completion (Glauber Costa) Disable qemu-io on Win32 Add files not included in previous commit. Fix savevm after BDRV_FILE size enforcement Fix the build for --disable-aio gdbstub: Rework configuration via command line and monitor (Jan Kiszka) Make `-icount' help fit 80 chars screen width (Robert Riebisch) qemu-io - an I/O path exerciser (Christoph Hellwig) Fix display breakage when resizing the screen (v2) (Avi Kivity) Fix some win32 compile warnings Make binary stripping conditional (Riku Voipio) qcow2: fix image creation for large, > ~2TB, images (Chris Wright) pci_add storage: fix error handling for 'if' parameter (Eduardo Habkost) build system: clean qemu-options.texi and gdbstub-xml.c (Jan Kiszka) build system: silent generation of doc files and qemu-options.h (Jan Kiszka) ... Conflicts: qemu/Makefile.target qemu/hw/vga.c qemu/vl.c Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/gdbstub.c b/gdbstub.c
index cbd5a7c75..955835800 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2340,27 +2340,40 @@ static int gdb_monitor_write(CharDriverState *chr, const uint8_t *buf, int len)
return len;
}
-int gdbserver_start(const char *port)
+#ifndef _WIN32
+static void gdb_sigterm_handler(int signal)
+{
+ if (vm_running)
+ vm_stop(EXCP_INTERRUPT);
+}
+#endif
+
+int gdbserver_start(const char *device)
{
GDBState *s;
- char gdbstub_port_name[128];
- int port_num;
- char *p;
+ char gdbstub_device_name[128];
CharDriverState *chr = NULL;
CharDriverState *mon_chr;
- if (!port || !*port)
- return -1;
- if (strcmp(port, "none") != 0) {
- 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;
+ if (!device)
+ return -1;
+ if (strcmp(device, "none") != 0) {
+ if (strstart(device, "tcp:", NULL)) {
+ /* enforce required TCP attributes */
+ snprintf(gdbstub_device_name, sizeof(gdbstub_device_name),
+ "%s,nowait,nodelay,server", device);
+ device = gdbstub_device_name;
}
+#ifndef _WIN32
+ else if (strcmp(device, "stdio") == 0) {
+ struct sigaction act;
- chr = qemu_chr_open("gdb", port, NULL);
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = gdb_sigterm_handler;
+ sigaction(SIGINT, &act, NULL);
+ }
+#endif
+ chr = qemu_chr_open("gdb", device, NULL);
if (!chr)
return -1;