From nobody Thu Nov 6 10:35:36 2025 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.zohomail.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 1540543521099605.6102865660529; Fri, 26 Oct 2018 01:45:21 -0700 (PDT) Received: from localhost ([::1]:58902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFxk7-0001vg-8v for importer@patchew.org; Fri, 26 Oct 2018 04:45:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFxUH-0000gN-EA for qemu-devel@nongnu.org; Fri, 26 Oct 2018 04:29:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFxJE-0004pf-H4 for qemu-devel@nongnu.org; Fri, 26 Oct 2018 04:17:33 -0400 Received: from greensocs.com ([193.104.36.180]:45400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFxJ9-0004lP-H0; Fri, 26 Oct 2018 04:17:29 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 10C58441B4F; Fri, 26 Oct 2018 10:17:17 +0200 (CEST) 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 SW1zuAOR-HPq; Fri, 26 Oct 2018 10:17:16 +0200 (CEST) Received: by greensocs.com (Postfix, from userid 998) id A0559441B47; Fri, 26 Oct 2018 10:17:14 +0200 (CEST) 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 2370A441B42; Fri, 26 Oct 2018 10:17:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1540541837; bh=tEd2P0fg10cenqbv0sIZIp+ENwFNIB8g6Mf2Gz9V6yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=5Kocbv/pl11xTrZ5EK4TjMC+Y5q4feTtmgEWTR1gLMIAY0YONP3UoqpnlyDcptq9/ o2ZUbT8qYFbfirrhKb03ZI8lJG7wpvGErU96mW8THmt5y6EKq5G0xxlLTIFDlxtmY3 RUG5UHpfGLaUs5ZVnJAn7DeeNz8R3bZGB5Vlswyk= 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=U3rZqD+F; dkim=pass (1024-bit key) header.d=greensocs.com header.b=U3rZqD+F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1540541834; bh=tEd2P0fg10cenqbv0sIZIp+ENwFNIB8g6Mf2Gz9V6yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=U3rZqD+F7OMmALIaJnM6+T4RLKr7CQYf1dKP+I+CKW44pN4qbo6Pv4qxkqyl8/N29 9+Qy/7hT5BvzoDbL7g184AxkZ/teCKu+Kik15pJv6V8TMHsn8j3EOLnMr1K8f1ByQO bRakPBpsZ1KwSf4DseiBS13Qn0BMSur6ArYV+UmQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1540541834; bh=tEd2P0fg10cenqbv0sIZIp+ENwFNIB8g6Mf2Gz9V6yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=U3rZqD+F7OMmALIaJnM6+T4RLKr7CQYf1dKP+I+CKW44pN4qbo6Pv4qxkqyl8/N29 9+Qy/7hT5BvzoDbL7g184AxkZ/teCKu+Kik15pJv6V8TMHsn8j3EOLnMr1K8f1ByQO bRakPBpsZ1KwSf4DseiBS13Qn0BMSur6ArYV+UmQ= From: Luc Michel To: qemu-devel@nongnu.org Date: Fri, 26 Oct 2018 10:16:43 +0200 Message-Id: <20181026081653.24602-7-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181026081653.24602-1-luc.michel@greensocs.com> References: <20181026081653.24602-1-luc.michel@greensocs.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v3 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=20Mathieu-Daud=C3=A9?= , saipava@xilinx.com, edgari@xilinx.com, qemu-arm@nongnu.org, Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (found 2 invalid signatures) Content-Type: text/plain; charset="utf-8" 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=C3=A9 Reviewed-by: Alistair Francis --- gdbstub.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index d1ec245d1d..17fec8a41c 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1543,13 +1543,18 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) type =3D strtoul(p, (char **)&p, 16); sstep_flags =3D type; put_packet(s, "OK"); break; } else if (strcmp(p,"C") =3D=3D 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 retur= n the + * first thread of the current process (gdb returns the first + * thread). + */ + cpu =3D 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") =3D=3D 0) { s->query_cpu =3D first_cpu; goto report_cpuinfo; } else if (strcmp(p,"sThreadInfo") =3D=3D 0) { --=20 2.19.1