From nobody Wed Nov 5 18:33: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 1535806240172835.3787451022879; Sat, 1 Sep 2018 05:50:40 -0700 (PDT) Received: from localhost ([::1]:37047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw5MN-0008C9-1d for importer@patchew.org; Sat, 01 Sep 2018 08:50:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw5JD-0004pE-J0 for qemu-devel@nongnu.org; Sat, 01 Sep 2018 08:47:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw5JC-0007o6-GA for qemu-devel@nongnu.org; Sat, 01 Sep 2018 08:47:23 -0400 Received: from greensocs.com ([193.104.36.180]:40643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw5J6-0007kR-QZ; Sat, 01 Sep 2018 08:47:17 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 7F297DFFE5; Sat, 1 Sep 2018 14:47:11 +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 cqsO6YAXV2_D; Sat, 1 Sep 2018 14:47:10 +0200 (CEST) Received: by greensocs.com (Postfix, from userid 998) id A562F521AAA; Sat, 1 Sep 2018 14:47:10 +0200 (CEST) Received: from michell-laptop.home.lmichel.fr (LFbn-LYO-1-488-36.w2-7.abo.wanadoo.fr [2.7.77.36]) (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 EA8FE521AAF; Sat, 1 Sep 2018 14:47:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1535806031; bh=YreZeTrW0Sv/0CWPHMxl5hdbM1k5LPGRr5JMFnrvDaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lIqRu3vv2TmQDGlX/cYIWtGT5J0gfJneMHlGjr9kpGhIsrcEfBJMkbgf2t3PCHGAl 6bp5Vsv7Wb4oT6BQHZCinbyaaUTHPStK4fnTEGe7Slt9EOD9SUtlvyTE27GwQvi5ii PLXCNUGhFFCQ/XCcTRFBJVHy2OMuKE3ywI/pqVAU= 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=uVJY3dJU; dkim=pass (1024-bit key) header.d=greensocs.com header.b=uVJY3dJU DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1535806030; bh=YreZeTrW0Sv/0CWPHMxl5hdbM1k5LPGRr5JMFnrvDaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uVJY3dJUHN/8JVXPGlEdChmD1YR4ARASr8kdn4kRzZL+vEjZM1+RswbmI1GJIksDe 1tMfcUulADBlR67Ub2pVlIoevP1G2G92S5aD4LLLyeO965bgegOWYu4/D1se8mHpA5 wQwSBnHEiUcTv7/8JK0oGQwNvwl+NhrulE9aj488= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1535806030; bh=YreZeTrW0Sv/0CWPHMxl5hdbM1k5LPGRr5JMFnrvDaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uVJY3dJUHN/8JVXPGlEdChmD1YR4ARASr8kdn4kRzZL+vEjZM1+RswbmI1GJIksDe 1tMfcUulADBlR67Ub2pVlIoevP1G2G92S5aD4LLLyeO965bgegOWYu4/D1se8mHpA5 wQwSBnHEiUcTv7/8JK0oGQwNvwl+NhrulE9aj488= From: Luc Michel To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 14:46:35 +0200 Message-Id: <20180901124639.19735-12-luc.michel@greensocs.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180901124639.19735-1-luc.michel@greensocs.com> References: <20180901124639.19735-1-luc.michel@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH 11/15] 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 , alistair@alistair23.me, mark.burton@greensocs.com, 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) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 --- gdbstub.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index 4bed0a85f3..4874d65a30 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1327,10 +1327,42 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) break; } goto unknown_command; } break; + } else if (strncmp(p, "Attach", 6) =3D=3D 0) { + unsigned long pid; + + p +=3D 7; + + qemu_strtoul(p, &p, 16, &pid); + + 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, + get_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.18.0