From patchwork Sat Nov 10 08:11:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luc Michel X-Patchwork-Id: 995843 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.b="I2Kcdxd1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=greensocs.com header.i=@greensocs.com header.b="6DMqK1nL"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=greensocs.com header.i=@greensocs.com header.b="6DMqK1nL"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42sVFr0hDkz9sCs for ; Sat, 10 Nov 2018 19:15:44 +1100 (AEDT) Received: from localhost ([::1]:37492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gLOQf-0004hx-If for incoming@patchwork.ozlabs.org; Sat, 10 Nov 2018 03:15:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gLOOv-0003qy-8M for qemu-devel@nongnu.org; Sat, 10 Nov 2018 03:13:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gLOOt-0000ns-BC for qemu-devel@nongnu.org; Sat, 10 Nov 2018 03:13:53 -0500 Received: from greensocs.com ([193.104.36.180]:43678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gLOOZ-0000TA-2Q; Sat, 10 Nov 2018 03:13:31 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 7957F5D19A1; Sat, 10 Nov 2018 09:13:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1541837606; bh=p2Mv8ssQ4PExXJBSLWQS/O2C8dspM4cwOB9TCaV84ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=I2Kcdxd1DjmBCJLrOaGwgcaEHkaE8dCoky1y7lNV8CFRuao+0BLspoEzDtliF0d2T aB3SRJVxpgGfk5GdDg85OfIPelco8X0XSMmU+3QL7Zyu9OR9oniqvT6A9+GSqhePVd dVKByyqaibrVv0AUwt3ASKl6nOPZ1yJ9P79iqPVI= 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=6DMqK1nL; dkim=pass (1024-bit key) header.d=greensocs.com header.b=6DMqK1nL 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 CRV24ZzVKG7o; Sat, 10 Nov 2018 09:13:25 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id D289144325A; Sat, 10 Nov 2018 09:13:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1541837603; bh=p2Mv8ssQ4PExXJBSLWQS/O2C8dspM4cwOB9TCaV84ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=6DMqK1nLb1yK9jkXAG4R6lI+0G1MpsHXLpGYwbW/xIWh5FyG2o4YaogNQq7XWMEWz BZrX2N5CJgffvk7acC2Zw8sKl59AiGNEQ7+6ZoySvypOsPygZJRev0CDpeSNiFEbCi LInNTA7/gMGWmtlo9PcmG4c8ywg1jRdAwH0YDyPk= 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 6C6A0443258; Sat, 10 Nov 2018 09:13:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1541837603; bh=p2Mv8ssQ4PExXJBSLWQS/O2C8dspM4cwOB9TCaV84ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=6DMqK1nLb1yK9jkXAG4R6lI+0G1MpsHXLpGYwbW/xIWh5FyG2o4YaogNQq7XWMEWz BZrX2N5CJgffvk7acC2Zw8sKl59AiGNEQ7+6ZoySvypOsPygZJRev0CDpeSNiFEbCi LInNTA7/gMGWmtlo9PcmG4c8ywg1jRdAwH0YDyPk= From: Luc Michel To: qemu-devel@nongnu.org Date: Sat, 10 Nov 2018 09:11:37 +0100 Message-Id: <20181110081147.4027-7-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181110081147.4027-1-luc.michel@greensocs.com> References: <20181110081147.4027-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 v5 06/16] 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 , Eduardo Habkost , 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 ba8b1a3413..9be83486f5 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1546,13 +1546,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) {