From patchwork Mon Oct 1 11:56:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luc Michel X-Patchwork-Id: 10621901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A520B6CB for ; Mon, 1 Oct 2018 11:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 930EB294A8 for ; Mon, 1 Oct 2018 11:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86CB4294B2; Mon, 1 Oct 2018 11:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 877C6294A8 for ; Mon, 1 Oct 2018 11:59:16 +0000 (UTC) Received: from localhost ([::1]:37806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6wr4-00041A-TY for patchwork-qemu-devel@patchwork.kernel.org; Mon, 01 Oct 2018 07:59:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6wpT-0002RG-B7 for qemu-devel@nongnu.org; Mon, 01 Oct 2018 07:57:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6wpQ-0005nn-Ld for qemu-devel@nongnu.org; Mon, 01 Oct 2018 07:57:35 -0400 Received: from greensocs.com ([193.104.36.180]:40044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6wpF-0005SV-W2; Mon, 01 Oct 2018 07:57:24 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 74D85511C79; Mon, 1 Oct 2018 13:57:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1538395031; bh=PnGrRRbiD++Gs8LrhEYq/EHRNpXoblJ2ZYiJIwiIGEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vekiIom0JfZn6L8I3bGollRHvMp6Ak495ktLYvixAKb3t7xFF0KHmEpDGveZSdWDb 9PKfbrAUBZ8YmtrFmwpPjFdwyxKEbqZRvgUy4rpyoTaKgyjOXARl967ofhEGUWCObe jxpGEvhgpBAR89RwIKHemYs0bivAkFQgiWGI1muQ= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com header.b=tNHvpBTB; dkim=pass (1024-bit key) header.d=greensocs.com header.b=tNHvpBTB Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 995cjeUtqhgG; Mon, 1 Oct 2018 13:57:10 +0200 (CEST) Received: by greensocs.com (Postfix, from userid 998) id 5C8D3511C6E; Mon, 1 Oct 2018 13:57:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1538395028; bh=PnGrRRbiD++Gs8LrhEYq/EHRNpXoblJ2ZYiJIwiIGEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tNHvpBTB/6TBGRnMxgWPP6bYjgOdUwAx503L7bHe5n8h/EE5yfDguMhkWFCGuoeAJ B8yDIWuNuwBzFG2mmhhYH9PhkDKLEtJtaLOmPYwfqWDQZjXS/A0RF2HpFb0b3RQcE0 TZVe27fiP6HC6plzog6RYKbjb1CTR2R0QozaX1x0= Received: from michell-laptop.home.lmichel.fr (LFbn-1-8165-82.w90-112.abo.wanadoo.fr [90.112.74.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luc.michel@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id CB6B0511C70; Mon, 1 Oct 2018 13:57:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1538395028; bh=PnGrRRbiD++Gs8LrhEYq/EHRNpXoblJ2ZYiJIwiIGEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tNHvpBTB/6TBGRnMxgWPP6bYjgOdUwAx503L7bHe5n8h/EE5yfDguMhkWFCGuoeAJ B8yDIWuNuwBzFG2mmhhYH9PhkDKLEtJtaLOmPYwfqWDQZjXS/A0RF2HpFb0b3RQcE0 TZVe27fiP6HC6plzog6RYKbjb1CTR2R0QozaX1x0= From: Luc Michel To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 13:56:54 +0200 Message-Id: <20181001115704.701-6-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181001115704.701-1-luc.michel@greensocs.com> References: <20181001115704.701-1-luc.michel@greensocs.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v2 05/15] 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: , Cc: Peter Maydell , alistair@alistair23.me, mark.burton@greensocs.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , saipava@xilinx.com, edgari@xilinx.com, qemu-arm@nongnu.org, Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- gdbstub.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 779cc8b241..3242f0d261 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1530,13 +1530,18 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) type = strtoul(p, (char **)&p, 16); sstep_flags = type; 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; goto report_cpuinfo; } else if (strcmp(p,"sThreadInfo") == 0) {