From nobody Wed Nov 5 18:33:15 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 1535806221372985.193032750496; Sat, 1 Sep 2018 05:50:21 -0700 (PDT) Received: from localhost ([::1]:37045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw5Lx-0007vD-Qc for importer@patchew.org; Sat, 01 Sep 2018 08:50:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw5JE-0004sH-6A for qemu-devel@nongnu.org; Sat, 01 Sep 2018 08:47:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw5JC-0007oj-U3 for qemu-devel@nongnu.org; Sat, 01 Sep 2018 08:47:24 -0400 Received: from greensocs.com ([193.104.36.180]:40636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw5J6-0007kD-OE; Sat, 01 Sep 2018 08:47:17 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id A45A8C7AC5; Sat, 1 Sep 2018 14:47:09 +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 LZcCImLprE-h; Sat, 1 Sep 2018 14:47:08 +0200 (CEST) Received: by greensocs.com (Postfix, from userid 998) id AA919521A9F; Sat, 1 Sep 2018 14:47:08 +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 B9474C7AC5; Sat, 1 Sep 2018 14:47:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1535806029; bh=YEe+bSOHxip03b/mKVTpeg3rx6MLOFwKQBwCoNaRXg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2MVsRv3vJckeHMKmdxLzRYINYlDd2h9FSWp/ht+a0HNslNG/eCdl89oADVMfy1TQo 3uLaIxSxBagcp/YBxDXTXh5Xs+e8rvEp7ry1q3YioA1Z1TvTiBo2Xaw7tamaeD6sMG Lg8PV8hJM/6KwsRVqpMuspzxMXq8KJDcBWa+zqcw= 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=houbh2g0; dkim=pass (1024-bit key) header.d=greensocs.com header.b=houbh2g0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1535806028; bh=YEe+bSOHxip03b/mKVTpeg3rx6MLOFwKQBwCoNaRXg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=houbh2g08bpcgk2ZVmw6SE71WN2gGseH88hM5pK0lPkUEAhgPPNaTw+6fqjp9Tg0D SkeNqwsVQboTkQonWzm/RtIZB4OtFt5yhY7JhgeDIIRHKVur6s1WE527cK6w2oLM4a TceQhRsU+vf/PzR90koGb8P0KMpmUHTYheS6bOck= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1535806028; bh=YEe+bSOHxip03b/mKVTpeg3rx6MLOFwKQBwCoNaRXg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=houbh2g08bpcgk2ZVmw6SE71WN2gGseH88hM5pK0lPkUEAhgPPNaTw+6fqjp9Tg0D SkeNqwsVQboTkQonWzm/RtIZB4OtFt5yhY7JhgeDIIRHKVur6s1WE527cK6w2oLM4a TceQhRsU+vf/PzR90koGb8P0KMpmUHTYheS6bOck= From: Luc Michel To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 14:46:32 +0200 Message-Id: <20180901124639.19735-9-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 08/15] gdbstub: add multiprocess support to gdb_vm_state_change() 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 multiprocess extension in gdb_vm_state_change() function. Signed-off-by: Luc Michel --- gdbstub.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 761cb051c8..4ccd1153ce 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1693,10 +1693,11 @@ void gdb_set_stop_cpu(CPUState *cpu) static void gdb_vm_state_change(void *opaque, int running, RunState state) { GDBState *s =3D gdbserver_state; CPUState *cpu =3D s->c_cpu; char buf[256]; + char thread_id[16]; const char *type; int ret; =20 if (running || s->state =3D=3D RS_INACTIVE) { return; @@ -1704,10 +1705,18 @@ static void gdb_vm_state_change(void *opaque, int r= unning, RunState state) /* Is there a GDB syscall waiting to be sent? */ if (s->current_syscall_cb) { put_packet(s, s->syscall_buf); return; } + + if (cpu =3D=3D NULL) { + /* No process attached */ + return; + } + + get_thread_id(s, cpu, thread_id, sizeof(thread_id)); + switch (state) { case RUN_STATE_DEBUG: if (cpu->watchpoint_hit) { switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) { case BP_MEM_READ: @@ -1721,12 +1730,12 @@ static void gdb_vm_state_change(void *opaque, int r= unning, RunState state) break; } trace_gdbstub_hit_watchpoint(type, cpu_gdb_index(cpu), (target_ulong)cpu->watchpoint_hit->vaddr); snprintf(buf, sizeof(buf), - "T%02xthread:%02x;%swatch:" TARGET_FMT_lx ";", - GDB_SIGNAL_TRAP, cpu_gdb_index(cpu), type, + "T%02xthread:%s;%swatch:" TARGET_FMT_lx ";", + GDB_SIGNAL_TRAP, thread_id, type, (target_ulong)cpu->watchpoint_hit->vaddr); cpu->watchpoint_hit =3D NULL; goto send_packet; } else { trace_gdbstub_hit_break(); @@ -1764,11 +1773,11 @@ static void gdb_vm_state_change(void *opaque, int r= unning, RunState state) trace_gdbstub_hit_unknown(state); ret =3D GDB_SIGNAL_UNKNOWN; break; } gdb_set_stop_cpu(cpu); - snprintf(buf, sizeof(buf), "T%02xthread:%02x;", ret, cpu_gdb_index(cpu= )); + snprintf(buf, sizeof(buf), "T%02xthread:%s;", ret, thread_id); =20 send_packet: put_packet(s, buf); =20 /* disable single step if it was enabled */ --=20 2.18.0