From nobody Sat Apr 26 03:26:48 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org> Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 154687940343821.72093120062607; Mon, 7 Jan 2019 08:43:23 -0800 (PST) Received: from localhost ([127.0.0.1]:45104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>) id 1ggXzc-0005Wd-Dz for importer@patchew.org; Mon, 07 Jan 2019 11:43:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <peter.maydell@linaro.org>) id 1ggXod-00053O-4E for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:31:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <peter.maydell@linaro.org>) id 1ggXoY-00026T-Ph for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:31:50 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:52648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <peter.maydell@linaro.org>) id 1ggXoY-0001xm-Bq for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:31:46 -0500 Received: by mail-wm1-x335.google.com with SMTP id m1so1470079wml.2 for <qemu-devel@nongnu.org>; Mon, 07 Jan 2019 08:31:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id j14sm46039759wrv.96.2019.01.07.08.31.39 for <qemu-devel@nongnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Jan 2019 08:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DggtY6HHQ9duEuWdFgn35E494xOLm+nkWBc8Po6gMWI=; b=DcyYB1mk5591/ecgG1AtOgceH6cqAVlsj1nMSeKLQxVCdqpZiUUCfdNnP+8WY/6YyH v3a4GYpHLru6EMGVZZHkKXKPzEdl+ow/vTvfynsOUGUryEjlT1AA8VU1cWV6MTnUnC5Z oIsMISeYlOkF4Nc1iWxrZN4dMh3bDmKkxVpM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DggtY6HHQ9duEuWdFgn35E494xOLm+nkWBc8Po6gMWI=; b=b5cyF9jTtHMAngAsKp18MGoTJ1mEDh3Mu8HnavlYzNN17xzzVvCS/iDVQKRVIIdUr4 kygETTbJtDyzhLgyhRuUYfXea4rT7kOJKpVcxp2yiShfFLBkb+EMo7G9mY+uj3jXBg9p dSd3cTQIbYZU6l/2qsxuTvHnlA0A0cApzPL2s6ti3eRCwMMzqHGlE7wDo9rdCw1XXcMI tJrS6lGdTOy0JbT2Ifl4OKdZKdNwZFW/gnIPf36slL5Mx/jJpoGkGmLOZmACMkEv92Qa RKIqyB9tE0wbWPyPTbsIpDcJ2btvWvOJP+cUUtIPLQZi9BWVnoPwZq3syUSYxU5CA0SW dWSA== X-Gm-Message-State: AJcUukfdqDBS0FiyMEkRnDrZe2skkB/aHdcLGaqQLIcsheRsmRmfF2kn r01J8Ie+pxjtWcsg/0PZPqkyLpflAEjnmw== X-Google-Smtp-Source: ALg8bN5NV5OoXcrdXu3TlLb8sVlbSsAFwP7ED8vtJU2rrrWWHG/MipK4btyr0aGf8IZ0Mtwg8bTLFw== X-Received: by 2002:a1c:1b8d:: with SMTP id b135mr9298964wmb.115.1546878700101; Mon, 07 Jan 2019 08:31:40 -0800 (PST) From: Peter Maydell <peter.maydell@linaro.org> To: qemu-devel@nongnu.org Date: Mon, 7 Jan 2019 16:30:56 +0000 Message-Id: <20190107163117.16269-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190107163117.16269-1-peter.maydell@linaro.org> References: <20190107163117.16269-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 Subject: [Qemu-devel] [PULL 16/37] 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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org> X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Luc Michel <luc.michel@greensocs.com> 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 <luc.michel@greensocs.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-id: 20181207090135.7651-15-luc.michel@greensocs.com [PMM: fix checkpatch comment style nit] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- gdbstub.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index 432e7d2f7da..1517563abe1 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1798,6 +1798,16 @@ static int gdb_handle_packet(GDBState *s, const char= *line_buf) =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 2.19.2