qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-trivial <qemu-trivial@nongnu.org>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Fabien Chouteau <chouteau@adacore.com>
Subject: [Qemu-devel] [PATCH 1/2] Add GDB qAttached support
Date: Sat, 31 Jan 2015 10:28:24 +0100	[thread overview]
Message-ID: <54CCA038.8000704@web.de> (raw)

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

From: Jan Kiszka <jan.kiszka@siemens.com>

With this patch QEMU handles qAttached request from gdb. When QEMU
replies 1, GDB sends a "detach" command at the end of a debugging
session otherwise GDB sends "kill".

The default value for qAttached is 1 on system emulation and 0 on user
emulation.

Based on original version by Fabien Chouteau.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Long pending in my queue. Hope we can finally get these two in via
trivial (that's what they are).

 gdbstub.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gdbstub.c b/gdbstub.c
index e4a1a79..da3e7cb 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -41,6 +41,12 @@
 #include "qemu/sockets.h"
 #include "sysemu/kvm.h"
 
+#ifdef CONFIG_USER_ONLY
+#define GDB_ATTACHED "0"
+#else
+#define GDB_ATTACHED "1"
+#endif
+
 static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
                                          uint8_t *buf, int len, bool is_write)
 {
@@ -1187,6 +1193,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             put_packet_binary(s, buf, len + 1);
             break;
         }
+        if (strncmp(p, "Attached", 8) == 0) {
+            put_packet(s, GDB_ATTACHED);
+            break;
+        }
         /* Unrecognised 'q' command.  */
         goto unknown_command;
 
-- 
2.1.4


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

             reply	other threads:[~2015-01-31  9:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-31  9:28 Jan Kiszka [this message]
2015-01-31  9:29 ` [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode" Jan Kiszka
2015-02-04 13:36 ` [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Pedro Alves
2015-02-04 14:06   ` Jan Kiszka
2015-02-04 14:30   ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2013-03-12 14:31 [Qemu-devel] [PATCH 0/2] " Fabien Chouteau
2013-03-12 14:31 ` [Qemu-devel] [PATCH 1/2] " Fabien Chouteau
2013-03-12 14:40   ` Jan Kiszka
2013-03-05 16:03 Fabien Chouteau
2013-03-10  8:06 ` Jan Kiszka
2013-03-11 11:22   ` Fabien Chouteau
2013-03-11 11:36     ` Jan Kiszka
2013-03-11 11:59       ` Fabien Chouteau

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=54CCA038.8000704@web.de \
    --to=jan.kiszka@web.de \
    --cc=chouteau@adacore.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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).