From patchwork Thu Jun 1 14:49:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 100936 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp842444qge; Thu, 1 Jun 2017 07:51:07 -0700 (PDT) X-Received: by 10.237.34.119 with SMTP id o52mr2445199qtc.217.1496328667618; Thu, 01 Jun 2017 07:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496328667; cv=none; d=google.com; s=arc-20160816; b=o8ph4Kwr10VwZ3sk6GQQMJZhsMNNme8w9VjbcpUlaBhXB4pNvODxKckb3uOhlH5gej 38RH4B2bofMuolf4PKi4HOvpzTdx/vXYycYXYK+3SVIsI3fbgLNsQbesnMcxgD4PKtV4 LTRmP+b/VeJsAVTEKehLKoOmiNGbzea3//HqdvqGIgE1WOq/f5CCWg8LMNySqzNnq9dx DDOur8jRxUbtSlBJdhE6ixM59afnNJe1m1Dofal4qjJjREnw8cWntzKc0HKZcZWKzy6z dPm51EKRlD9Ut/A5YZ7sZub8dDinxqH/AS3Dk9Ca5JuFJ7uALDhvJnBO419ZT/EBDqRs yXhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=5OogvM61zaVGLQSzQRGX5MoPluxmn9smhK+bGD4tX3M=; b=lrh3xlOPHklqkAEpFAJvibKKoNUvci+lABKX0XCw458A9ST820ZEyCMpBaUjpEVOxS XbAN7lY3oSnJFUttBW4MjEMKK0ciyIT8nOvMQmv7IkQ29u5mhA9kA/o3CM7KiYVJoLgS lgd1DGoQ+Vnx2Js837agULR8Hx+jJSUx1m4qyf/wMdpRrqJmFE6TySkt1fQYm+M7wr/4 vdkllNiv+g7UPJD/gqqElf5AjPjMdDNtH4SZDPVOxxCPZyXEaNz6Oe2JHd15sDZ7NPIQ NFcpEMy5iZQLbxYbupr+kE/EAoMRaxUeYjaUzPVGgclAX3W8xQxDudCWH5a//4uGSJ1A yVEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q76si19282505qki.199.2017.06.01.07.51.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Jun 2017 07:51:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRRJ-0005eE-97 for patch@linaro.org; Thu, 01 Jun 2017 10:51:05 -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) 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) 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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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='vCont;C04:0;c' put_packet: reply='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ée Reviewed-by: Greg Kurz --- v2 - used Greg's less convoluted suggestion - expand commit message --- gdbstub.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) -- 2.13.0 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Claudio Imbrenda 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 = tmp; + /* 0 means any thread, so we pick the first valid CPU */ - if (!idx) { - idx = cpu_gdb_index(first_cpu); - } + cpu = tmp ? find_cpu(tmp) : first_cpu; - /* - * 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 = find_cpu(idx); /* invalid CPU/thread specified */ - if (!idx || !cpu) { + if (!cpu) { res = -EINVAL; goto out; } + /* only use if no previous match occourred */ if (newstates[cpu->cpu_index] == 1) { newstates[cpu->cpu_index] = cur_action;