From nobody Wed Nov 5 18:37:19 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.zoho.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 1496408922158275.2014064452636; Fri, 2 Jun 2017 06:08:42 -0700 (PDT) Received: from localhost ([::1]:49712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGmJi-0000e3-Hc for importer@patchew.org; Fri, 02 Jun 2017 09:08:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGmGJ-0006H1-HK for qemu-devel@nongnu.org; Fri, 02 Jun 2017 09:05:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGmGE-0002fI-PQ for qemu-devel@nongnu.org; Fri, 02 Jun 2017 09:05:07 -0400 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:34662) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGmGE-0002es-Id for qemu-devel@nongnu.org; Fri, 02 Jun 2017 09:05:02 -0400 Received: by mail-wr0-x22c.google.com with SMTP id g76so6683697wrd.1 for ; Fri, 02 Jun 2017 06:05:02 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x37sm39747831wrb.42.2017.06.02.06.04.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 06:04:59 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 308D13E0334; Fri, 2 Jun 2017 14:05:19 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=373B82/lO7Ee29Th9u3Ny6pJqw3QChtQzNQzvI0GHDw=; b=GoYoqJoP9c8T3+U28WbFHCm+xSs1RJE8rOodVtZSsCns69FSgVrXsKutXS/I9Un6xo 67PvQ9IXBbXToDDqAmfilz8uO2MxTBAYvnQciSG8jdqbMzXzVKFRe85S+JYQfJ40KnZb 2ZibYshNGFjZCBabCJmCVjUv65cC+prIsN3kA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=373B82/lO7Ee29Th9u3Ny6pJqw3QChtQzNQzvI0GHDw=; b=IF3Q88R9fb/usDZci54PPOTDwaM/f9Zi/s27/+40KZPnqB1i+bWMRj/p93qVnZliY6 tkKmVYU14KrnloQ9O4ygJPtmfnt28rTHEasHUcqyhQQwbOlvPJ4Iy/o1t0Gg7hLHIPUZ rflgnE9SZrAVhWF3nPNqOZsCTpT4Cy5UINlDrbAO4t2wmc1/drpP5eHjJXS+iHpl0syB qbk0SfWGeMgCSyiEUnBs/OxA6v7MZKANzHcZyMEG/eC/KHROzZBXi4F60dhn3HfGdaaC Ru4ujAN6f2Q4oQXfhbAJh6qJB8WCzdtjKysm/y8xftdbzx8Awwrr5O6w1BBAjK+/7kT8 C+Aw== X-Gm-Message-State: AODbwcCRTlXHk76SIWgHZ1n1ELzVVeoycQmL8cHbkcMwaz+fMp9IROSq SXZeXYXySeCt7DeQ X-Received: by 10.223.164.7 with SMTP id d7mr4685641wra.183.1496408701394; Fri, 02 Jun 2017 06:05:01 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, pbonzini@redhat.com, doug16k@gmail.com, imbrenda@linux.vnet.ibm.com Date: Fri, 2 Jun 2017 14:05:18 +0100 Message-Id: <20170602130518.22943-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602130518.22943-1-alex.bennee@linaro.org> References: <20170602130518.22943-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22c Subject: [Qemu-devel] [PATCH v3 4/4] gdbstub: don't fail on vCont; C04:0; c packets 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 The thread-id of 0 means any CPU but we then ignore the fact we find the first_cpu in this case who can have an index of 0. Instead of bailing out just test if we have managed to match up thread-id to a CPU. Otherwise you get: gdb_handle_packet: command=3D'vCont;C04:0;c' put_packet: reply=3D'E22' The actual reason for gdb sending vCont;C04:0;c was fixed in a previous commit where we ensure the first_cpu's tid is correctly reported to gdb however we should still behave correctly next time it does send 0. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Greg Kurz Reviewed-by: Claudio Imbrenda Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- v2 - used Greg's less convoluted suggestion - expand commit message --- gdbstub.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 45a3a0b16b..6b1e72e9f7 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -937,23 +937,16 @@ static int gdb_handle_vcont(GDBState *s, const char *= p) if (res) { goto out; } - idx =3D tmp; + /* 0 means any thread, so we pick the first valid CPU */ - if (!idx) { - idx =3D cpu_gdb_index(first_cpu); - } + cpu =3D tmp ? find_cpu(tmp) : first_cpu; =20 - /* - * If we are in user mode, the thread specified is actually a - * thread id, and not an index. We need to find the actual - * CPU first, and only then we can use its index. - */ - cpu =3D find_cpu(idx); /* invalid CPU/thread specified */ - if (!idx || !cpu) { + if (!cpu) { res =3D -EINVAL; goto out; } + /* only use if no previous match occourred */ if (newstates[cpu->cpu_index] =3D=3D 1) { newstates[cpu->cpu_index] =3D cur_action; --=20 2.13.0