From patchwork Mon Jan 7 16:30:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 154927 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3681656ljp; Mon, 7 Jan 2019 08:46:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN7fIFKjrgbAFmRPTZWZOQ2Tfos3S/j3mZcWVg8QhgFglQjPo7L4YlBBWoLXiDC/GXkYCLvr X-Received: by 2002:a5d:694d:: with SMTP id r13mr50209888wrw.323.1546879612157; Mon, 07 Jan 2019 08:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546879612; cv=none; d=google.com; s=arc-20160816; b=OSeKKs+/GC+Msn4AKINFhELrdrfCnaiD2e2LUqAYqcvPwywag4qHXafORnZtgHCLXc Wh/zTYpDa+Tig3lkN00PCfQVwRxeMZUbF5mGfIqz95yYhfgtD3+7lZOlBsQLLE9l21zv C0l6srpHrM35vjKxdoVHmCMBFjuoQ3iA8lHfS/dgqbRsL0aQ2fkzo3GVbFN7uw4KNmVO 9s2AHzdTkoubRP3lYuyvMvvTX8lK4eH7gsIU2AIaOyb+B5tQuI9/G9ZzdcfR/eXbxfED hIk/YhUJVHbGsIlP/gSf3ykw/TXP/uVekv+20pT//iZehAS3e6qwqnv+IYOcOPTH577J dWcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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; bh=YmllhqSrlPuqu/kNnOCys3nYm3gqrfzNAGZ2x7fkAlw=; b=hLT+r46KtrfgqQE2mIbZJ3M2rAIRFDQvy/8kUo3oNYJx7O6qJvMSeeYckP5ISmYkJz 86Ujn03H2aJ22EynDok+MZxxZ3oDmTTwJIhKzJYEEJ3+mixkkdPnVWFThD7xmj68zkGI iRp9yZZXVZEBG3NHjJSONRa/ZFzgWgbHrwgcOvW26dW/zz9Ebf1qcCGh8RXm0vyxQ93n yQe+/C+x1u8GVuR4kpEiA9KRXVGiTEnnDOdtm7LDwYvVAc7s7R8xBxiyEgHVLKMOiIz0 GnATNdFi2zvOr0RtNkf8VjvNtNBAAtSC6xzFpOQiRwaTpI49+3XUGfBebC2bWFPlF4Jn U9hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IB5vzVrm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id z193si5357562wmc.130.2019.01.07.08.46.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 07 Jan 2019 08:46:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IB5vzVrm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:46054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggY39-0000Xe-3p for patch@linaro.org; Mon, 07 Jan 2019 11:46:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggXoR-0004ue-Cm for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:31:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggXoO-0001rx-P6 for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:31:38 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:50232) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggXoM-0001iy-Ai for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:31:35 -0500 Received: by mail-wm1-x32f.google.com with SMTP id n190so1469885wmd.0 for ; Mon, 07 Jan 2019 08:31:32 -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=YmllhqSrlPuqu/kNnOCys3nYm3gqrfzNAGZ2x7fkAlw=; b=IB5vzVrmErKVL/AydwAR6mFEVp1IZtovJn+U3XZsIBFYUv2Rv7W773o7vfg3xh5sKv WCgf06mneblIbhy3fVdF/g0GM1gq7Sky3+qUkkL0dSVIU23hg6RLiocIKtYH7azyD89j ON8HQndOwu+HECfzEgk4RhDDBbKhITKtBqwas= 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=YmllhqSrlPuqu/kNnOCys3nYm3gqrfzNAGZ2x7fkAlw=; b=aFbN4iq3t02iZ3p2huErTIbPDZ7Z74nYXLyvzegzLfRk4ieKT/q26Kocw3ba8opDvk BUXJKCEgiY9qvlM5yzOqR/QqjG8er05mZOYMbhQ6h78PCaVGUR5/cfmz0l7wCiRCauXC pnnwwNk0jYFwhuLz+amywNTMjia+rKLmn3mlQ/b5vJMb78DnYwPfCn8FnBtxZqEyCtDV /iH1P27gG4XAd7aRIX8H5SsR7GNrofqXLhRrxdqmy9nFcHL3buduJGEQ4eBLSnuIAz1s i/1PNs4HJkPd8vhcJ6XpCw+BGIOkGBrBuF858/cc8Pkw/k0R2oeya46q7y9AKsvHzhaV aXpQ== X-Gm-Message-State: AJcUukdM6rcqwU6TaubsWiUKA8gplKCzVwYxQrJLYZhR2Ji9+5NmsKlZ 4VneRNBLJ6Ed33W4/mPOd/cKfnzLmvi44A== X-Received: by 2002:a1c:2408:: with SMTP id k8mr8833322wmk.110.1546878691257; Mon, 07 Jan 2019 08:31:31 -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.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Jan 2019 08:31:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 7 Jan 2019 16:30:48 +0000 Message-Id: <20190107163117.16269-9-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f Subject: [Qemu-devel] [PULL 08/37] gdbstub: add multiprocess support to 'sC' 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Luc Michel Change the sC packet handling to support the multiprocess extension. Instead of returning the first thread, we return the first thread of the current process. Signed-off-by: Luc Michel Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Reviewed-by: Edgar E. Iglesias Message-id: 20181207090135.7651-7-luc.michel@greensocs.com [PMM: corrected checkpatch comment style nit] Signed-off-by: Peter Maydell --- gdbstub.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- 2.19.2 diff --git a/gdbstub.c b/gdbstub.c index 09114ea7769..1ba7aa6a28a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1554,9 +1554,15 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) put_packet(s, "OK"); break; } else if (strcmp(p,"C") == 0) { - /* "Current thread" remains vague in the spec, so always return - * the first CPU (gdb returns the first thread). */ - put_packet(s, "QC1"); + /* + * "Current thread" remains vague in the spec, so always return + * the first thread of the current process (gdb returns the + * first thread). + */ + cpu = get_first_cpu_in_process(s, gdb_get_cpu_process(s, s->g_cpu)); + snprintf(buf, sizeof(buf), "QC%s", + gdb_fmt_thread_id(s, cpu, thread_id, sizeof(thread_id))); + put_packet(s, buf); break; } else if (strcmp(p,"fThreadInfo") == 0) { s->query_cpu = first_cpu;