From nobody Wed Nov 5 23:47:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538396061745863.1880452000486; Mon, 1 Oct 2018 05:14:21 -0700 (PDT) Received: from localhost ([::1]:38120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6x5g-00034O-Gm for importer@patchew.org; Mon, 01 Oct 2018 08:14:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6wpn-0002kQ-GZ for qemu-devel@nongnu.org; Mon, 01 Oct 2018 07:57:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6wpm-00061o-Lp for qemu-devel@nongnu.org; Mon, 01 Oct 2018 07:57:55 -0400 Received: from greensocs.com ([193.104.36.180]:40140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6wph-0005jS-Br; Mon, 01 Oct 2018 07:57:49 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 96BD2511C75; Mon, 1 Oct 2018 13:57:15 +0200 (CEST) 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 vMZ17Cc9RQtU; Mon, 1 Oct 2018 13:57:14 +0200 (CEST) Received: by greensocs.com (Postfix, from userid 998) id 88852511C6F; Mon, 1 Oct 2018 13:57:12 +0200 (CEST) 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 DFFD4511C6E; Mon, 1 Oct 2018 13:57:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1538395035; bh=11JYwxGBPnuaFsCIuYEBJZlUexokehWYmRnK8HTFNQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zimx3OPgd5eoBTf2RjQ2/wM65v757qYOtB4h4PhbP0wT3AGBzII6Kez1niqE6Dfgu zpA9eFEfOiSnoqVJgrjoQ84+4i2XstJoz3hdBNwWY3riIzTNzfTEZPu6NWR3/EiFm7 6hK2OSyEgEGXZi+puxgAu5q3GE6EP9ohgmxvdiHU= 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=IuaE7kuN; dkim=pass (1024-bit key) header.d=greensocs.com header.b=IuaE7kuN DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1538395032; bh=11JYwxGBPnuaFsCIuYEBJZlUexokehWYmRnK8HTFNQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IuaE7kuNWo5Q6HtBzpaiX8dBVgdySaJQ98nEWraYzCByKmiFsq+uea9wL8182oCQg MdFqLeNSWvXxprnSHOHmPpf7rAI2IsvRzrdijJTx0k1J2Jk+nY9ThogHNtbHKFOjd4 9Xh19zQcqfsrmSnnh4Ru3u/LTUM8+/uJAq5X2q28= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1538395032; bh=11JYwxGBPnuaFsCIuYEBJZlUexokehWYmRnK8HTFNQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IuaE7kuNWo5Q6HtBzpaiX8dBVgdySaJQ98nEWraYzCByKmiFsq+uea9wL8182oCQg MdFqLeNSWvXxprnSHOHmPpf7rAI2IsvRzrdijJTx0k1J2Jk+nY9ThogHNtbHKFOjd4 9Xh19zQcqfsrmSnnh4Ru3u/LTUM8+/uJAq5X2q28= From: Luc Michel To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 13:57:02 +0200 Message-Id: <20181001115704.701-14-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181001115704.701-1-luc.michel@greensocs.com> References: <20181001115704.701-1-luc.michel@greensocs.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v2 13/15] 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 , alistair@alistair23.me, mark.burton@greensocs.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , saipava@xilinx.com, edgari@xilinx.com, qemu-arm@nongnu.org, Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 get confused if it receives packets with a thread-id it does not know about. Signed-off-by: Luc Michel --- gdbstub.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index c27a3edf1d..51cc11981e 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1763,10 +1763,19 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) return RS_IDLE; } =20 void gdb_set_stop_cpu(CPUState *cpu) { + GDBProcess *p =3D gdb_get_cpu_process(gdbserver_state, cpu); + + if (!p->attached) { + /* Having a stop CPU corresponding to a process that is not attach= ed + * confuses GDB. So we ignore the request. + */ + return; + } + gdbserver_state->c_cpu =3D cpu; gdbserver_state->g_cpu =3D cpu; } =20 #ifndef CONFIG_USER_ONLY --=20 2.19.0