qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: qemu-user/gdbstub : gdb remote pipe connexion addition ?
Date: Sat, 21 Mar 2009 10:30:14 +0100	[thread overview]
Message-ID: <49C4B3A6.2020009@web.de> (raw)
In-Reply-To: <20090320145101.GA20641@otto.imag.fr>

[-- Attachment #1: Type: text/plain, Size: 2120 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2009-03-21  9:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-20 14:51 [Qemu-devel] qemu-user/gdbstub : gdb remote pipe connexion addition ? Philippe Waille
2009-03-21  9:30 ` Jan Kiszka [this message]
2009-03-24 12:52 ` Paul Brook
2009-03-25 22:58   ` Philippe Waille

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=49C4B3A6.2020009@web.de \
    --to=jan.kiszka@web.de \
    --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).