From nobody Wed Oct 8 18:54:50 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 1542965062703692.3945721593136; Fri, 23 Nov 2018 01:24:22 -0800 (PST) Received: from localhost ([::1]:51180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQ7hE-0005X7-KL for importer@patchew.org; Fri, 23 Nov 2018 04:24:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQ7bQ-0008Ng-T4 for qemu-devel@nongnu.org; Fri, 23 Nov 2018 04:18:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQ7bP-0001rQ-7P for qemu-devel@nongnu.org; Fri, 23 Nov 2018 04:18:20 -0500 Received: from greensocs.com ([193.104.36.180]:47080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQ7bE-0000Xv-RM; Fri, 23 Nov 2018 04:18:09 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 0C4C25E7088; Fri, 23 Nov 2018 10:17:41 +0100 (CET) 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 3hk5S3Q6FsPI; Fri, 23 Nov 2018 10:17:39 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id 0F3EF5E7086; Fri, 23 Nov 2018 10:17:38 +0100 (CET) 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 9CBCD5E7083; Fri, 23 Nov 2018 10:17:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542964661; bh=ZLuPgX6ec2FObaTIqeyzjk4B3ZvcrU3B9tfb5cjhetg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bqJ5X+ybZB2Kq2oLvBW4v5X7utOc+YlA+IZdbpj6LCTMLixGX6oAjy9SIhKlv19k5 CZbMIjnkkzY+88vewec03IrGh1l1onr2FcgXXoK4S4GV4c0OxLEacqb2GSf5kHAmqA PG7d8gRlCnWSM/WAWoe1hlAcCpT9P1wMco7yTgOY= 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=jS1M5Ym3; dkim=pass (1024-bit key) header.d=greensocs.com header.b=ob85STlQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542964658; bh=ZLuPgX6ec2FObaTIqeyzjk4B3ZvcrU3B9tfb5cjhetg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jS1M5Ym3Phu13bvNX7xJvaeh9vANJdMxcJzR70s5Jju3GMbHZbtoPXfZHN9aDC+IG ic4RzdxDi4L6W2AY0Oy4a88olQqtwwuidH8B1JgbmKAraJkeqE7AOwMgPZ6Yw5SM4k qyGLevDD7iEGRAUTX1wefhtbV5eDN/h7bsC/0kFE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542964657; bh=ZLuPgX6ec2FObaTIqeyzjk4B3ZvcrU3B9tfb5cjhetg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ob85STlQL5AgV8p7RG3b4sVaUoQReC2MvvvTUUaLmjLYPAvlZB/mNUEerr94pFMtM sx2mUfgkBxFEykuXxwBH2A4qUxpwM9AzRtOsHS12wK7RzX62W170YCdGuZ7v5Rlx3c tVlzKwHzLt1m0fsawClwjeJeweYY/n+6OzjPfp3E= From: Luc Michel To: qemu-devel@nongnu.org Date: Fri, 23 Nov 2018 10:17:27 +0100 Message-Id: <20181123091729.29921-15-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123091729.29921-1-luc.michel@greensocs.com> References: <20181123091729.29921-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 [fuzzy] X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v7 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=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 3 invalid signatures) 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 gets confused if it receives packets with a thread-id it does not know about. Signed-off-by: Luc Michel Acked-by: Alistair Francis Reviewed-by: Edgar E. Iglesias --- gdbstub.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index 6518324d46..6fc1630643 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1791,10 +1791,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.1