From patchwork Sat Nov 10 08:11:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Michel X-Patchwork-Id: 995848 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.b="ONxJ/5bO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=greensocs.com header.i=@greensocs.com header.b="VnF4Fp1G"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=greensocs.com header.i=@greensocs.com header.b="VnF4Fp1G"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42sVN045ZPz9sCs for ; Sat, 10 Nov 2018 19:21:04 +1100 (AEDT) Received: from localhost ([::1]:37520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gLOVq-000271-4w for incoming@patchwork.ozlabs.org; Sat, 10 Nov 2018 03:21:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gLOP7-00045F-P5 for qemu-devel@nongnu.org; Sat, 10 Nov 2018 03:14:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gLOP5-000105-If for qemu-devel@nongnu.org; Sat, 10 Nov 2018 03:14:05 -0500 Received: from greensocs.com ([193.104.36.180]:43679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gLOOz-0000TB-Bn; Sat, 10 Nov 2018 03:13:58 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 4E95C5D19A4; Sat, 10 Nov 2018 09:13:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1541837611; bh=WgnMQ5pr+n/ESL8puF7jtpCC/FdzwfDNBDnQ0ACltqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ONxJ/5bODy4hKL0+eazHbh0v3fv0+dzMnA6CuAd5T/o5izwNhYRnx5jW0ywx+sSJu 54vU8wZgerY95of8ohEJ66jMQjaU0CYo/uTS7czvgWrRzGA+zuIFhseq8qaQKK+1LS tFZNuTtfllPX9Fq9IHoCU3XUO2f+jcFmKuawoThg= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com header.b=VnF4Fp1G; dkim=pass (1024-bit key) header.d=greensocs.com header.b=VnF4Fp1G Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6gh6pPo9W7AB; Sat, 10 Nov 2018 09:13:30 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id 6FB9A5D19A3; Sat, 10 Nov 2018 09:13:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1541837607; bh=WgnMQ5pr+n/ESL8puF7jtpCC/FdzwfDNBDnQ0ACltqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VnF4Fp1GPMGYOHF4HlqkRbHAPM61HOLBHOeLe1jdoeWTgcmQdLauaxzMGlQa4rXky L9EZ0ma0tp0R3mJ1x0LnPktT4ub1jAs1+zZTv7jsvqUQ3eg17T83wKoo29ONRsTqr3 kBI7HiSsagd6fyvcNCFwyYYliTVz2oFRzRn0AFV8= Received: from michell-laptop.home.lmichel.fr (lfbn-1-8165-82.w90-112.abo.wanadoo.fr [90.112.74.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luc.michel@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id 00E395D19A3; Sat, 10 Nov 2018 09:13:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1541837607; bh=WgnMQ5pr+n/ESL8puF7jtpCC/FdzwfDNBDnQ0ACltqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VnF4Fp1GPMGYOHF4HlqkRbHAPM61HOLBHOeLe1jdoeWTgcmQdLauaxzMGlQa4rXky L9EZ0ma0tp0R3mJ1x0LnPktT4ub1jAs1+zZTv7jsvqUQ3eg17T83wKoo29ONRsTqr3 kBI7HiSsagd6fyvcNCFwyYYliTVz2oFRzRn0AFV8= From: Luc Michel To: qemu-devel@nongnu.org Date: Sat, 10 Nov 2018 09:11:45 +0100 Message-Id: <20181110081147.4027-15-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181110081147.4027-1-luc.michel@greensocs.com> References: <20181110081147.4027-1-luc.michel@greensocs.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v5 14/16] gdbstub: gdb_set_stop_cpu: ignore request when process is not attached X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , alistair@alistair23.me, mark.burton@greensocs.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , saipava@xilinx.com, edgari@xilinx.com, qemu-arm@nongnu.org, Luc Michel Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When gdb_set_stop_cpu() is called with a CPU associated to a process currently not attached by the GDB client, return without modifying the stop CPU. Otherwise, GDB gets confused if it receives packets with a thread-id it does not know about. Signed-off-by: Luc Michel Acked-by: Alistair Francis --- gdbstub.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index 1a3353ff3c..c662ada6ff 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1787,10 +1787,19 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) return RS_IDLE; } void gdb_set_stop_cpu(CPUState *cpu) { + GDBProcess *p = gdb_get_cpu_process(gdbserver_state, cpu); + + if (!p->attached) { + /* Having a stop CPU corresponding to a process that is not attached + * confuses GDB. So we ignore the request. + */ + return; + } + gdbserver_state->c_cpu = cpu; gdbserver_state->g_cpu = cpu; } #ifndef CONFIG_USER_ONLY