qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH V3 1/3] Add GDB qAttached support


From: Fabien Chouteau
Subject: [Qemu-devel] [PATCH V3 1/3] Add GDB qAttached support
Date: Tue, 12 Mar 2013 18:31:30 +0100

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.

This patch implements the requirement described in Jan Kiszka's patch:
"gdbstub: Do not kill target in system emulation mode". The patch can
therefore be reverted.

Signed-off-by: Fabien Chouteau <address@hidden>
---
 gdbstub.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gdbstub.c b/gdbstub.c
index e414ad9..70d54ce 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -42,6 +42,12 @@
 #include "sysemu/kvm.h"
 #include "qemu/bitops.h"
 
+#ifdef CONFIG_USER_ONLY
+static bool gdb_attached; /* false */
+#else
+static bool gdb_attached = true;
+#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 ? "1" : "0");
+            break;
+        }
         /* Unrecognised 'q' command.  */
         goto unknown_command;
 
-- 
1.7.9.5




reply via email to

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