From nobody Tue Feb 10 02:00:55 2026 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 149632865764711.265692127660714; Thu, 1 Jun 2017 07:50:57 -0700 (PDT) Received: from localhost ([::1]:45059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRRA-0005eE-77 for importer@patchew.org; Thu, 01 Jun 2017 10:50:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRPM-0004YM-S4 for qemu-devel@nongnu.org; Thu, 01 Jun 2017 10:49:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGRPL-0002WA-T4 for qemu-devel@nongnu.org; Thu, 01 Jun 2017 10:49:04 -0400 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:37353) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGRPL-0002Vo-N1 for qemu-devel@nongnu.org; Thu, 01 Jun 2017 10:49:03 -0400 Received: by mail-wm0-x22d.google.com with SMTP id d127so63405140wmf.0 for ; Thu, 01 Jun 2017 07:49:03 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o65sm17626580wmo.19.2017.06.01.07.48.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 07:48:59 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 955CA3E04BC; Thu, 1 Jun 2017 15:49:15 +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=5OogvM61zaVGLQSzQRGX5MoPluxmn9smhK+bGD4tX3M=; b=FyG6GHLEH3VKMXCJYLdQSgvBTLUWkSmi6DUT3/vfMvUM1gF66rg0Y8JBsoC1pUMnCE /5UGuc0zjpMOXXsXkwugNKeaJAH4EHId/AlU7opQVoupwpxNT+qYAsQhr36rMyyDc0J8 azMMfXdRowdMETvvyXlRImR/9typk1c33X8M0= 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=5OogvM61zaVGLQSzQRGX5MoPluxmn9smhK+bGD4tX3M=; b=Zc2mfUM3Z/Oso+YydwUa0IZIH0WsC9TgT22/lGtwX9rIABSHUf+obvMcP69T06IZsa 8Vv3fh/Lh1MEjTbDir617WKhGvCEGFPhqdLtksHbeFDV6FmmZW7l0vg5P7ODkLCyyzqC 20QkCOX1rjYnlAW6S0S9lPScquMFThV5+MhA6TG1eql8fxv1lWNiFUu59GT+i/lLPqE7 cI2icQ8BPSshzkPKyWkt2g730gzGU5ILxlWxRm3tNkaroCq0Bs+z8fMHLRpwnfGtB/dj 676xc0GcnrESOE+RAR4UrK4zHv0xbCwOR8uvmSFjyZY9zMQ70bjR9YXx5m3IwlW4TYNH WPMg== X-Gm-Message-State: AODbwcCtepsli9TQaQ6id3NJg9YvGRIoyPObT+2spRmpF7QHWwb6AlBu 53VL7hxEkwpUHtv2 X-Received: by 10.223.150.39 with SMTP id b36mr1830921wra.149.1496328542195; Thu, 01 Jun 2017 07:49:02 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: pbonzini@redhat.com, doug16k@gmail.com, imbrenda@linux.vnet.ibm.com Date: Thu, 1 Jun 2017 15:49:15 +0100 Message-Id: <20170601144915.20778-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170601144915.20778-1-alex.bennee@linaro.org> References: <20170601144915.20778-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:c09::22d Subject: [Qemu-devel] [PATCH v2 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