From nobody Thu Nov 6 18:22:14 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 1542275543586831.3697661739443; Thu, 15 Nov 2018 01:52:23 -0800 (PST) Received: from localhost ([::1]:37709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNEJy-0005jH-Gt for importer@patchew.org; Thu, 15 Nov 2018 04:52:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNEAl-0007Nu-Ih for qemu-devel@nongnu.org; Thu, 15 Nov 2018 04:42:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNEAh-0004fz-Iv for qemu-devel@nongnu.org; Thu, 15 Nov 2018 04:42:51 -0500 Received: from greensocs.com ([193.104.36.180]:41904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNEAU-0004NP-RJ; Thu, 15 Nov 2018 04:42:36 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id E4B27400FE4; Thu, 15 Nov 2018 10:42:18 +0100 (CET) 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 YIPpuE792Sck; Thu, 15 Nov 2018 10:42:18 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id 08A6144325D; Thu, 15 Nov 2018 10:42:17 +0100 (CET) Received: from michell-laptop.hive.antfield.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 343CB441B67; Thu, 15 Nov 2018 10:42:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542274938; bh=9Lroo8lp/NrsN5CPeEin+WNWgbyuC7KOEH8dyRxdbv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aoa52CNhhi5eV5iI+pBG38VFZM//Mm4GVbxZpXPq1kK4EWbwcuPOoQX4Qwf3xmCJi 51Ey0too37A6H21z0/ptCo73OFcLiIxRycI2/78mlVYYAvEQnti4BxEnGl7zfAsNeI MkZJvx/kX6DW9Cg2gxQ3dp/0Vhr/sgY458I6CecA= 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=aoa52CNh; dkim=pass (1024-bit key) header.d=greensocs.com header.b=pDd0cKIw DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542274938; bh=9Lroo8lp/NrsN5CPeEin+WNWgbyuC7KOEH8dyRxdbv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aoa52CNhhi5eV5iI+pBG38VFZM//Mm4GVbxZpXPq1kK4EWbwcuPOoQX4Qwf3xmCJi 51Ey0too37A6H21z0/ptCo73OFcLiIxRycI2/78mlVYYAvEQnti4BxEnGl7zfAsNeI MkZJvx/kX6DW9Cg2gxQ3dp/0Vhr/sgY458I6CecA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1542274937; bh=9Lroo8lp/NrsN5CPeEin+WNWgbyuC7KOEH8dyRxdbv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pDd0cKIwnSxhkx+rhz4E9vc5vzZdwb6VHlt4kCi6UYCf9z3s53XkQ3EcDmu5uN+f/ 90kbqU+85K2EhnALZc6YeaQpvvXBKENFd1X0d9wUBPNIKLQJxSHGhAJIr+Ax6P7uwV /nLe7jRlnaVSMYv8+ql65gIkg35gIuP64T3oMsH8= From: Luc Michel To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 10:42:03 +0100 Message-Id: <20181115094207.22846-13-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115094207.22846-1-luc.michel@greensocs.com> References: <20181115094207.22846-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 v6 12/16] gdbstub: add support for vAttach 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" Add support for the vAttach packets. In multiprocess mode, GDB sends them to attach to additional processes. Signed-off-by: Luc Michel Acked-by: Alistair Francis Reviewed-by: Edgar E. Iglesias --- gdbstub.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index ada53ac559..0427d1c4f0 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1340,10 +1340,45 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) break; } goto unknown_command; } break; + } else if (strncmp(p, "Attach;", 7) =3D=3D 0) { + unsigned long pid; + + p +=3D 7; + + if (qemu_strtoul(p, &p, 16, &pid)) { + put_packet(s, "E22"); + break; + } + + process =3D gdb_get_process(s, pid); + + if (process =3D=3D NULL) { + put_packet(s, "E22"); + break; + } + + cpu =3D get_first_cpu_in_process(s, process); + + if (cpu =3D=3D NULL) { + /* Refuse to attach an empty process */ + put_packet(s, "E22"); + break; + } + + process->attached =3D true; + + s->g_cpu =3D cpu; + s->c_cpu =3D cpu; + + snprintf(buf, sizeof(buf), "T%02xthread:%s;", GDB_SIGNAL_TRAP, + gdb_fmt_thread_id(s, cpu, thread_id, sizeof(thread_id= ))); + + put_packet(s, buf); + break; } else { goto unknown_command; } case 'k': /* Kill the target */ --=20 2.19.1