Received: from eggs.gnu.org ([2001:4830:134:3::10]:35128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9oW9-0008Rq-8p for qemu-devel@nongnu.org; Tue, 30 Jun 2015 01:55:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9oW4-0005nn-9i for qemu-devel@nongnu.org; Tue, 30 Jun 2015 01:55:37 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:10117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9oW4-0005nL-3H for qemu-devel@nongnu.org; Tue, 30 Jun 2015 01:55:32 -0400 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 2C096DE5DB9A1 for ; Tue, 30 Jun 2015 06:55:28 +0100 (IST) From: Bhushan Attarde Date: Tue, 30 Jun 2015 11:25:19 +0530 Message-ID: <1435643719-8692-1-git-send-email-bhushan.attarde@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] gdbstub:Return non-zero value for thread-id in user mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Yongbok.Kim@imgtec.com, Bhushan Attarde , jaydeep.patil@imgtec.com When client requests the stop information by sending ? packet, the gdbstub replies with stop info packet which includes thread-id of the stopped thread. In user mode this thread-id is given by cpu->host_tid, which could be zero. Some clients treats thread-id zero as invalid thread-id. This patch ensures that in user mode, gdbstub returns non-zero value for thread-id in stop reply packet. Signed-off-by: Bhushan Attarde --- include/exec/gdbstub.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index a608a26..3e6114c 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -33,7 +33,7 @@ void gdb_register_coprocessor(CPUState *cpu, static inline int cpu_index(CPUState *cpu) { #if defined(CONFIG_USER_ONLY) - return cpu->host_tid; + return cpu->host_tid ? cpu->host_tid : 1; #else return cpu->cpu_index + 1; #endif -- 2.4.4