qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Fabien Chouteau <chouteau@adacore.com>
Subject: [Qemu-devel] [PATCH v4] Add GDB qAttached support
Date: Thu, 14 Mar 2013 20:51:25 +0100	[thread overview]
Message-ID: <51422A3D.7000308@siemens.com> (raw)
In-Reply-To: <1363109492-1901-2-git-send-email-chouteau@adacore.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>
---

As Fabien dropped his attempt to make this configurable, let's
preserve the value of exposing this feature to gdb statically.

 gdbstub.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index e414ad9..9daee86 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -42,6 +42,12 @@
 #include "sysemu/kvm.h"
 #include "qemu/bitops.h"
 
+#ifdef CONFIG_USER_ONLY
+#define GDB_ATTACHED "0"
+#else
+#define GDB_ATTACHED "1"
+#endif
+
 #ifndef TARGET_CPU_MEMORY_RW_DEBUG
 static inline int target_memory_rw_debug(CPUArchState *env, target_ulong addr,
                                          uint8_t *buf, int len, int is_write)
@@ -2491,6 +2497,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             break;
         }
 #endif
+        if (strncmp(p, "Attached", 8) == 0) {
+            put_packet(s, GDB_ATTACHED);
+            break;
+        }
         /* Unrecognised 'q' command.  */
         goto unknown_command;
 
-- 
1.7.3.4

  reply	other threads:[~2013-03-14 19:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12 17:31 [Qemu-devel] [PATCH V3 0/3] Add GDB qAttached support Fabien Chouteau
2013-03-12 17:31 ` [Qemu-devel] [PATCH V3 1/3] " Fabien Chouteau
2013-03-14 19:51   ` Jan Kiszka [this message]
2013-03-14 21:07     ` [Qemu-devel] [PATCH v4] " Jesse Larrew
2013-03-15 12:02       ` Fabien Chouteau
2013-03-19 10:37         ` Fabien Chouteau
2013-05-01 14:18     ` Jan Kiszka
2013-03-12 17:31 ` [Qemu-devel] [PATCH V3 2/3] Revert "gdbstub: Do not kill target in system emulation mode" Fabien Chouteau
2013-03-14 19:52   ` Jan Kiszka
2013-03-12 17:31 ` [Qemu-devel] [PATCH V3 3/3] New option -gdb-opts Fabien Chouteau
2013-03-14  8:44   ` Markus Armbruster
2013-03-14 10:59     ` Fabien Chouteau
2013-03-14 12:34       ` Markus Armbruster
2013-03-14 16:33         ` Fabien Chouteau
2013-03-19 14:31           ` Markus Armbruster

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=51422A3D.7000308@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=aliguori@us.ibm.com \
    --cc=chouteau@adacore.com \
    --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).