qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: qemu-user/gdbstub : gdb remote pipe connexion addition


From: Jan Kiszka
Subject: [Qemu-devel] Re: qemu-user/gdbstub : gdb remote pipe connexion addition ?
Date: Sat, 21 Mar 2009 10:30:14 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

Philippe Waille wrote:
> Hi
> 
> Qemu gdbstub only allows GDB remote target connexion through IP socket.
> 
> Would the GDB remote pipe connexion method be also supported in future 
> versions
> (as does openocd for remote access to jtag interfaces), like this :
> 
> (gdb) target remote | exec openocd --pipe
> (gdb) target remote | exec qemu-arm --pipe a.out
> 
> Simultaneous execution of several (user-mode arm simulators) qemu-arm by a 
> set of users sharing a single server would be easier to manage with 
> gdb connexion through pipes instead of IP port/socket.

Check out [1]. It basically enhances qemu like that (the corresponding
switch would be '-gdb stdio'), but only for system emulation. An add-on
patch to extend user mode emulator in a similar way would be welcome!

There is one more thing to solve for both emulator modes: SIGINT has to
be trapped and handled by the gdbstub (currently, breaking into the
target terminates qemu). These hunks do the trick for system emulation:

diff --git a/gdbstub.c b/gdbstub.c
index a087553..1f43264 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2446,6 +2446,14 @@ static int gdb_monitor_write(CharDriverState *chr, const 
uint8_t *buf, int len)
     return len;
 }
 
+#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;
@@ -2462,7 +2470,15 @@ int gdbserver_start(const char *device)
                      "%s,nowait,nodelay,server", device);
             device = gdbstub_device_name;
         }
+#ifndef _WIN32
+        else if (strcmp(device, "stdio") == 0) {
+            struct sigaction act;
 
+            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;

Will merge this into some -v2 of my patch.

Jan

[1] http://permalink.gmane.org/gmane.comp.emulators.qemu/39836

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]