From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2mii-0001di-E6 for qemu-devel@nongnu.org; Fri, 26 Jul 2013 14:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2mih-0000F0-Cn for qemu-devel@nongnu.org; Fri, 26 Jul 2013 14:26:28 -0400 Received: from thoth.sbs.de ([192.35.17.2]:22958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2mih-0000Ek-2h for qemu-devel@nongnu.org; Fri, 26 Jul 2013 14:26:27 -0400 Message-ID: <51F2BF4F.8030107@siemens.com> Date: Fri, 26 Jul 2013 20:26:23 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <51E65168.5080907@siemens.com> In-Reply-To: <51E65168.5080907@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2 1/2] Add GDB qAttached support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel , Fabien Chouteau 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 --- v2: Rebase over master gdbstub.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 35ca7c2..4a6cc51 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 + static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr, uint8_t *buf, int len, bool is_write) { @@ -2489,6 +2495,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