[Top][All Lists]

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

[Qemu-devel] [PATCH 1/2][RESENT] Add GDB qAttached support

From: Jan Kiszka
Subject: [Qemu-devel] [PATCH 1/2][RESENT] Add GDB qAttached support
Date: Wed, 17 Jul 2013 10:10:16 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv: Gecko/20080226 SUSE/ Thunderbird/ Mnenhy/

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

Based on original version by Fabien Chouteau.

Signed-off-by: Jan Kiszka <address@hidden>
 gdbstub.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index 0ee82a9..bc626f5 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -42,6 +42,12 @@
 #include "sysemu/kvm.h"
 #include "qemu/bitops.h"
+#define GDB_ATTACHED "0"
+#define GDB_ATTACHED "1"
 static inline int target_memory_rw_debug(CPUArchState *env, target_ulong addr,
                                          uint8_t *buf, int len, int is_write)
@@ -2504,6 +2510,10 @@ static int gdb_handle_packet(GDBState *s, const char 
+        if (strncmp(p, "Attached", 8) == 0) {
+            put_packet(s, GDB_ATTACHED);
+            break;
+        }
         /* Unrecognised 'q' command.  */
         goto unknown_command;

reply via email to

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