From nobody Sat Nov 23 23:17:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1728552667; cv=none; d=zohomail.com; s=zohoarc; b=EpJ29zJbQJz79/2bbdS6IfJnL+PaNchieciTlGTRmF6Cz5tWUy9TSh7vOcFljn0IW+fhH+yqiGXC5YsaghexxkQrd0YSiwFuRSlZaHdB1q2lgzbkUrSZDUVJ4M5p+lhvFSUMz2FGr7/jNnpemJ1BT0zEdp5oRXoFhLJtq86ivQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728552667; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dFuj6Hn6kok/CBdjstBhKZXei+/iC/1+QozKCBxd9fg=; b=INXGerwOSssaNgsysZnV883gHuuhlTxdWlZkKEWJy7x0wmCKmgQg+OUS0/e3Al+++RXA1yPvHOTXLyFBo/cvXXWRO24PIR0IWLipyf65oY6BkHb9Qx5opRJfVagXlsHZ+SCyjPvdagKuh8Paa8TsvWofNOv1x6R3CTfj62UvdN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17285526675941020.6346864986848; Thu, 10 Oct 2024 02:31:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sypUZ-0001lR-B2; Thu, 10 Oct 2024 05:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUX-0001kU-5h for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUV-000421-8X for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:52 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A3p856009556; Thu, 10 Oct 2024 09:29:49 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4267cmshrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:48 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49A6MGlv022847; Thu, 10 Oct 2024 09:29:47 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 423h9k6uwn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:46 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49A9TjPT57934148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Oct 2024 09:29:45 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09FD72004B; Thu, 10 Oct 2024 09:29:45 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8FAFE20040; Thu, 10 Oct 2024 09:29:44 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.88.135]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 10 Oct 2024 09:29:44 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=dFuj6Hn6kok/C BdjstBhKZXei+/iC/1+QozKCBxd9fg=; b=X4R3XwlF0hIJCtul4nPZu6itMj2ZR AgTNWuTy/QwZ2kjFtCrzozN5NOxMRa65zyjjT6JT2sG7ZCLjchKTGorD/8AL0nhT HGUbwQ5e7xC3jxSztDhFZ3wClj3Ug2g5xJ9BFT4KMSCRuxQqhhImGAtDxyIj3hsE jssiR2qC94M4ofT6TVoqs8AUH/cApxviwMvxHr0lKMSmxJo2/WpQHJ8uIWwITB43 1c5jj+HgjVm6hxZKld2V7FprNf53pfGfwh7L8+KJFfDhu4honWJnVdsx4hs3Wvf7 uuUmx3pBIlLiHkaLJPwnUBS43O9RWiVK8rfIAam75JSc29z8K9Op0oUlA== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 1/4] gdbstub: Make gdb_get_char() static Date: Thu, 10 Oct 2024 11:26:56 +0200 Message-ID: <20241010092938.226868-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010092938.226868-1-iii@linux.ibm.com> References: <20241010092938.226868-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Jw85FKBZWbwLiOZ32C70tQstAKQxF3UL X-Proofpoint-GUID: Jw85FKBZWbwLiOZ32C70tQstAKQxF3UL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-10_05,2024-10-09_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 priorityscore=1501 phishscore=0 mlxlogscore=920 mlxscore=0 spamscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410100062 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1728552669522116600 Content-Type: text/plain; charset="utf-8" It's user-only since commit a7e0f9bd2ace ("gdbstub: abstract target specific details from gdb_put_packet_binary"). Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich --- gdbstub/internals.h | 2 -- gdbstub/user.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index bf5a5c63029..5acc36846f3 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -142,8 +142,6 @@ void gdb_create_default_process(GDBState *s); int gdb_signal_to_target(int sig); int gdb_target_signal_to_gdb(int sig); =20 -int gdb_get_char(void); /* user only */ - /** * gdb_continue() - handle continue in mode specific way. */ diff --git a/gdbstub/user.c b/gdbstub/user.c index 0b4bfa9c488..1fef5201f4e 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -103,7 +103,7 @@ typedef struct { =20 static GDBUserState gdbserver_user_state; =20 -int gdb_get_char(void) +static int gdb_get_char(void) { uint8_t ch; int ret; --=20 2.46.2 From nobody Sat Nov 23 23:17:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1728552616; cv=none; d=zohomail.com; s=zohoarc; b=LcgNZJ8hY65sN+9mF87z5eNeMaB54oBE/9taIi2lTheIgdgAEissvMxoR0zhTkQUsUKrCegm12Km2yD/pypDjb7mJHGEDTDbt/kTbbm5aNadO2Diu7wGWIvEhDO5vXui7okND1br+wssDzpCQqz7Za9Y9XjDBt/ONEJQafsGczM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728552616; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tNrIMaIFg/sBalnXDItBwVSU7MCj5OSIYKMxf0+uv/w=; b=dPB+ho1XAkuKkKF0tzUd/r2WnnekChtQAGCCKPjiStKfDD7unqYhhEYFbq70v0wnjUG1R+Kr907gwwTmrcDtX766Vbd016ciBV1TpwE4IqGWKb6mrdEeRroUOLYB2mQsw2sKBRKD3ytFfLGir7XzXKC9PXTF2i7DtPrd0W6Y4Co= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728552616854288.3932338865128; Thu, 10 Oct 2024 02:30:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sypUX-0001kV-Is; Thu, 10 Oct 2024 05:29:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUV-0001kD-O1 for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUU-00041j-6e for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:51 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A6XLxu029153; Thu, 10 Oct 2024 09:29:48 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4269rn8us2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:48 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49A9H0wZ030174; Thu, 10 Oct 2024 09:29:48 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 423gsmxygn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:47 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49A9Tkgg57475472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Oct 2024 09:29:46 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB5182004B; Thu, 10 Oct 2024 09:29:45 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A03CC20040; Thu, 10 Oct 2024 09:29:45 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.88.135]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 10 Oct 2024 09:29:45 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=tNrIMaIFg/sBa lnXDItBwVSU7MCj5OSIYKMxf0+uv/w=; b=D8qQYCahbiInfkT/GVNBJAZ8CBdaH Wjp+ZOKupLJ4vHC9PUE/v/Je5HKnIBmB4RldMTOFLHPyZnH3JlIs3qkDHeKs8MUV bRmlX8d0uD9XYyrvccW9Vdp6DrujjwpLT4Dugg5bkk3UIfSNEeg/7bBYMTa5zmw3 bABJW4nXnx7StTd32Xcwc0U9mbLYolpb18uNBAA+EqBvisNrnvmff/TCLGXgc6xI pY8ELqEJ+PL4BKy1LI4KzzAmCstQcKOxN3yBUaQ1Q4o9xw3aifaCoAYvCW4FyZGU xbHqEAuLBU9HqKwExgFJTyQhYXpf6JbNuLBs8FKvQhfrsbmw6nqgzEK4A== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 2/4] gdbstub: Move phy_memory_mode to GDBSystemState Date: Thu, 10 Oct 2024 11:26:57 +0200 Message-ID: <20241010092938.226868-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010092938.226868-1-iii@linux.ibm.com> References: <20241010092938.226868-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: zJuXRJXGSY6_rZkVLwH1YpM1i5XhNR6z X-Proofpoint-GUID: zJuXRJXGSY6_rZkVLwH1YpM1i5XhNR6z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-10_05,2024-10-09_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410100060 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1728552617321116600 Content-Type: text/plain; charset="utf-8" Follow the convention that all the pieces of the global stub state must be inside a single struct. While at it, convert phy_memory_mode to bool. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich --- gdbstub/system.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gdbstub/system.c b/gdbstub/system.c index c9f236e94f7..2e31e42f7dd 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -35,6 +35,7 @@ typedef struct { CharBackend chr; Chardev *mon_chr; + bool phy_memory_mode; } GDBSystemState; =20 GDBSystemState gdbserver_system_state; @@ -445,14 +446,12 @@ void gdb_qemu_exit(int code) /* * Memory access */ -static int phy_memory_mode; - int gdb_target_memory_rw_debug(CPUState *cpu, hwaddr addr, uint8_t *buf, int len, bool is_write) { CPUClass *cc; =20 - if (phy_memory_mode) { + if (gdbserver_system_state.phy_memory_mode) { if (is_write) { cpu_physical_memory_write(addr, buf, len); } else { @@ -491,7 +490,8 @@ bool gdb_can_reverse(void) void gdb_handle_query_qemu_phy_mem_mode(GArray *params, void *ctx) { - g_string_printf(gdbserver_state.str_buf, "%d", phy_memory_mode); + g_string_printf(gdbserver_state.str_buf, "%d", + gdbserver_system_state.phy_memory_mode); gdb_put_strbuf(); } =20 @@ -503,9 +503,9 @@ void gdb_handle_set_qemu_phy_mem_mode(GArray *params, v= oid *ctx) } =20 if (!gdb_get_cmd_param(params, 0)->val_ul) { - phy_memory_mode =3D 0; + gdbserver_system_state.phy_memory_mode =3D false; } else { - phy_memory_mode =3D 1; + gdbserver_system_state.phy_memory_mode =3D true; } gdb_put_packet("OK"); } --=20 2.46.2 From nobody Sat Nov 23 23:17:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1728552655; cv=none; d=zohomail.com; s=zohoarc; b=AAsOHAjSlZYtk3vtkSXetrFcxQ9elZN3fObmDMYCiyGgJnPoYdXyFReru03n1VzUm0yy/m/FQVzTiftN9fd4AAXzyJZ0Rzp9F/0a1gevsKy/SymTcSiCU4MYWR1Dxwiwk2g/hD3AZLGDuo+vo4zHZw+FM7rFoRuzC/c1gIRuUpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728552655; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=raGt82Lvie/fIt220smPBBRBaaTO+apes42SKzL3CmM=; b=WqSA5BfUcebarGGzj3gV0o0zk2qbOmMpyZUUCnzPyKcI23O0q1wmw/Egbp38/Fio0EaZyK84WA1vYBDPg6tJ8BT9WF0O+dIHWMuqvDWOZfkmL/pJ5G/BAJ+p3dxbmD03LNKr4Ajczh0aOGjPk4GZ6xCct3OCuF4WWeUkl+k+kmY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728552655717359.41297653799427; Thu, 10 Oct 2024 02:30:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sypUb-0001mU-II; Thu, 10 Oct 2024 05:29:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUW-0001kM-HJ for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:52 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUV-000425-3F for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:52 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A6XLxv029153; Thu, 10 Oct 2024 09:29:49 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4269rn8us4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:49 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49A6Wdgw010711; Thu, 10 Oct 2024 09:29:48 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 423j0jpr29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:48 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49A9TkEX51511720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Oct 2024 09:29:46 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEA662004B; Thu, 10 Oct 2024 09:29:46 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70ACC20040; Thu, 10 Oct 2024 09:29:46 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.88.135]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 10 Oct 2024 09:29:46 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=raGt82Lvie/fI t220smPBBRBaaTO+apes42SKzL3CmM=; b=LF2vd5yMjov8opxILyXbtJtUvvE9E 1IcOSdjr1ge9LbvgzLGjc6D/Ox+gxesMOSxaixxTRbjnvvzD206U02tXYunL9D0y U7urlxN+v7cEGHbJywtj/EJSBeAHaJZFLqrc8FshGkX4ptrpyJUuVUASteVKKFI2 dH9Pl1h8+85hM8JWdKmh8LnuU48+baXXF6vBvDcBCUqaS2z77i8MIqL7vA5BO/VY YVzEDNCuCe7Kt6EcVIqnyQJsAK23s+s3JH/Nig/8/S4IIHMS12f3kDzivYmGdyuh Gjy4r0kyNTixHYt4aybEq/PvSman6f8hU9ypzTi+KwK9npt4b9m41mUUQ== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 3/4] gdbstub: Move gdb_syscall_mode to GDBSyscallState Date: Thu, 10 Oct 2024 11:26:58 +0200 Message-ID: <20241010092938.226868-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010092938.226868-1-iii@linux.ibm.com> References: <20241010092938.226868-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: rJMyV03N7z9aL8ARayiR51ZDx9no0kSV X-Proofpoint-GUID: rJMyV03N7z9aL8ARayiR51ZDx9no0kSV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-10_05,2024-10-09_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410100060 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1728552657449116600 Content-Type: text/plain; charset="utf-8" Follow the convention that all the pieces of the global stub state must be inside a single struct. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich --- gdbstub/syscalls.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gdbstub/syscalls.c b/gdbstub/syscalls.c index 4ddd5cae067..bf6a6c01b4f 100644 --- a/gdbstub/syscalls.c +++ b/gdbstub/syscalls.c @@ -24,6 +24,11 @@ typedef struct { char syscall_buf[256]; gdb_syscall_complete_cb current_syscall_cb; + enum { + GDB_SYS_UNKNOWN, + GDB_SYS_ENABLED, + GDB_SYS_DISABLED, + } mode; } GDBSyscallState; =20 static GDBSyscallState gdbserver_syscall_state; @@ -37,12 +42,6 @@ static bool gdb_attached(void) return gdbserver_state.init && gdbserver_state.c_cpu; } =20 -static enum { - GDB_SYS_UNKNOWN, - GDB_SYS_ENABLED, - GDB_SYS_DISABLED, -} gdb_syscall_mode; - /* Decide if either remote gdb syscalls or native file IO should be used. = */ int use_gdb_syscalls(void) { @@ -57,16 +56,17 @@ int use_gdb_syscalls(void) =20 /* -semihosting-config target=3Dauto */ /* On the first call check if gdb is connected and remember. */ - if (gdb_syscall_mode =3D=3D GDB_SYS_UNKNOWN) { - gdb_syscall_mode =3D gdb_attached() ? GDB_SYS_ENABLED : GDB_SYS_DI= SABLED; + if (gdbserver_syscall_state.mode =3D=3D GDB_SYS_UNKNOWN) { + gdbserver_syscall_state.mode =3D gdb_attached() ? GDB_SYS_ENABLED : + GDB_SYS_DISABLED; } - return gdb_syscall_mode =3D=3D GDB_SYS_ENABLED; + return gdbserver_syscall_state.mode =3D=3D GDB_SYS_ENABLED; } =20 /* called when the stub detaches */ void gdb_disable_syscalls(void) { - gdb_syscall_mode =3D GDB_SYS_DISABLED; + gdbserver_syscall_state.mode =3D GDB_SYS_DISABLED; } =20 void gdb_syscall_reset(void) --=20 2.46.2 From nobody Sat Nov 23 23:17:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1728552667; cv=none; d=zohomail.com; s=zohoarc; b=GOdwd252zeTArrVqUu8J4G7v4e4ezEd7MQjamLGRxwjVNhDbAIk49Hss1Pa8nw5bC3VU10eG4BvdQGDHkJmYAKhkJ72GuTr9F/qRUrbKSPxwgfQRHapNK7sHYk7jKV3uI5EGEtcypfutH6xj1MNLEtAtxw/Jx2//fDoaT8WqOt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728552667; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ETncT5lCyhzwGnMjBB6nolyPPKdi2oajEmG/BBYp5h8=; b=g7nD8+I1Jfu8xO+l2YtcdDSNd0zdvgIbr9Z/nwL2QE7Pp0fuaOdJVJWbDBvxEc/KHmIvuRHk7TLUnCRXRGM9/5WvqrC3ZCtLeR8JZHpZZ/9/+Xg78mOCuMXC+5wsHlEInItdcy9o88qCbgahQvcSxc1IiUJeWdpPYJbybXLDg6c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17285526674995.133511347530543; Thu, 10 Oct 2024 02:31:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sypUa-0001lx-0x; Thu, 10 Oct 2024 05:29:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUX-0001ks-OK for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:53 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sypUV-00042N-Vj for qemu-devel@nongnu.org; Thu, 10 Oct 2024 05:29:53 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A8K1VO003803; Thu, 10 Oct 2024 09:29:50 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 426bapgapu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:50 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49A8jhvY011505; Thu, 10 Oct 2024 09:29:49 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 423g5xy2xu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 09:29:49 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49A9TlLM29426406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Oct 2024 09:29:47 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 809E32004E; Thu, 10 Oct 2024 09:29:47 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3313020040; Thu, 10 Oct 2024 09:29:47 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.88.135]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 10 Oct 2024 09:29:47 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=ETncT5lCyhzwG nMjBB6nolyPPKdi2oajEmG/BBYp5h8=; b=GccHQ2P7W1YOgEJwBnDb1RzxFCkK3 aR9yCL27axgnamCOgdw4rMRo/cwKpiF8c5zEZkjMG5IucXZFW42u60EMCDQ4udkh TBzm9cU8w5Bq9Cmz5DVUbXcl4MZ6fVJqKqaY29RZg9ecMcWjn/i67gQQRI4UvmXV 4ChA+xw5iVEBwIRAVPIzPFUFynA1DUqAJVD5TqzvVFCkH5SZcCVuZniIoeoTp8d6 hkTgJcYjnyVlSa4hueAKnfsWWuxwJ8CrYEGi+u8Ig/DIpPtUty+XTsPDc0Kv99FZ 0vX4S7KMZ6eCkIbZhWhkXorEnbnjaRtJjqEMuayb6NGaCBGSjyudMolzQ== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 4/4] gdbstub: Factor out gdb_try_stop() Date: Thu, 10 Oct 2024 11:26:59 +0200 Message-ID: <20241010092938.226868-5-iii@linux.ibm.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010092938.226868-1-iii@linux.ibm.com> References: <20241010092938.226868-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: apvGy05YBMZw16HXZYjxSd0gsXoRWazf X-Proofpoint-GUID: apvGy05YBMZw16HXZYjxSd0gsXoRWazf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-10_05,2024-10-09_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=821 malwarescore=0 impostorscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410100062 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1728552669604116600 Content-Type: text/plain; charset="utf-8" Move checking and setting allow_stop_reply into a function. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich --- gdbstub/gdbstub.c | 15 +++++++++++---- gdbstub/internals.h | 2 ++ gdbstub/system.c | 6 ++---- gdbstub/user.c | 11 ++++------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index b1def7e71d2..c45934b52b8 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -1422,11 +1422,10 @@ static void handle_v_attach(GArray *params, void *u= ser_ctx) gdbserver_state.g_cpu =3D cpu; gdbserver_state.c_cpu =3D cpu; =20 - if (gdbserver_state.allow_stop_reply) { + if (gdb_try_stop()) { g_string_printf(gdbserver_state.str_buf, "T%02xthread:", GDB_SIGNA= L_TRAP); gdb_append_thread_id(cpu, gdbserver_state.str_buf); g_string_append_c(gdbserver_state.str_buf, ';'); - gdbserver_state.allow_stop_reply =3D false; cleanup: gdb_put_strbuf(); } @@ -2016,12 +2015,11 @@ static void handle_gen_set(GArray *params, void *us= er_ctx) =20 static void handle_target_halt(GArray *params, void *user_ctx) { - if (gdbserver_state.allow_stop_reply) { + if (gdb_try_stop()) { g_string_printf(gdbserver_state.str_buf, "T%02xthread:", GDB_SIGNA= L_TRAP); gdb_append_thread_id(gdbserver_state.c_cpu, gdbserver_state.str_bu= f); g_string_append_c(gdbserver_state.str_buf, ';'); gdb_put_strbuf(); - gdbserver_state.allow_stop_reply =3D false; } /* * Remove all the breakpoints when this query is issued, @@ -2493,3 +2491,12 @@ void gdb_create_default_process(GDBState *s) process->target_xml =3D NULL; } =20 +bool gdb_try_stop(void) +{ + if (!gdbserver_state.allow_stop_reply) { + return false; + } + + gdbserver_state.allow_stop_reply =3D false; + return true; +} diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 5acc36846f3..310861e581b 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -215,4 +215,6 @@ void gdb_breakpoint_remove_all(CPUState *cs); int gdb_target_memory_rw_debug(CPUState *cs, hwaddr addr, uint8_t *buf, int len, bool is_write); =20 +bool gdb_try_stop(void); + #endif /* GDBSTUB_INTERNALS_H */ diff --git a/gdbstub/system.c b/gdbstub/system.c index 2e31e42f7dd..64cfcf25221 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -141,7 +141,7 @@ static void gdb_vm_state_change(void *opaque, bool runn= ing, RunState state) return; } =20 - if (!gdbserver_state.allow_stop_reply) { + if (!gdb_try_stop()) { return; } =20 @@ -211,7 +211,6 @@ static void gdb_vm_state_change(void *opaque, bool runn= ing, RunState state) =20 send_packet: gdb_put_packet(buf->str); - gdbserver_state.allow_stop_reply =3D false; =20 /* disable single step if it was enabled */ cpu_single_step(cpu, 0); @@ -428,10 +427,9 @@ void gdb_exit(int code) =20 trace_gdbstub_op_exiting((uint8_t)code); =20 - if (gdbserver_state.allow_stop_reply) { + if (gdb_try_stop()) { snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code); gdb_put_packet(buf); - gdbserver_state.allow_stop_reply =3D false; } =20 qemu_chr_fe_deinit(&gdbserver_system_state.chr, true); diff --git a/gdbstub/user.c b/gdbstub/user.c index 1fef5201f4e..17bcb9d70d9 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -181,10 +181,9 @@ void gdb_exit(int code) =20 trace_gdbstub_op_exiting((uint8_t)code); =20 - if (gdbserver_state.allow_stop_reply) { + if (gdb_try_stop()) { snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code); gdb_put_packet(buf); - gdbserver_state.allow_stop_reply =3D false; } =20 } @@ -222,7 +221,7 @@ int gdb_handlesig(CPUState *cpu, int sig, const char *r= eason, void *siginfo, =20 if (sig !=3D 0) { gdb_set_stop_cpu(cpu); - if (gdbserver_state.allow_stop_reply) { + if (gdb_try_stop()) { g_string_printf(gdbserver_state.str_buf, "T%02xthread:", gdb_target_signal_to_gdb(sig)); gdb_append_thread_id(cpu, gdbserver_state.str_buf); @@ -231,7 +230,6 @@ int gdb_handlesig(CPUState *cpu, int sig, const char *r= eason, void *siginfo, g_string_append(gdbserver_state.str_buf, reason); } gdb_put_strbuf(); - gdbserver_state.allow_stop_reply =3D false; } } /* @@ -276,13 +274,12 @@ void gdb_signalled(CPUArchState *env, int sig) char buf[4]; =20 if (!gdbserver_state.init || gdbserver_user_state.fd < 0 || - !gdbserver_state.allow_stop_reply) { + !gdb_try_stop()) { return; } =20 snprintf(buf, sizeof(buf), "X%02x", gdb_target_signal_to_gdb(sig)); gdb_put_packet(buf); - gdbserver_state.allow_stop_reply =3D false; } =20 static void gdb_accept_init(int fd) @@ -502,7 +499,7 @@ void gdbserver_fork_end(CPUState *cpu, pid_t pid) gdbserver_user_state.fork_peer_pid =3D pid; gdbserver_user_state.fork_peer_tid =3D pid; =20 - if (!gdbserver_state.allow_stop_reply) { + if (!gdb_try_stop()) { goto fail; } g_string_printf(gdbserver_state.str_buf, --=20 2.46.2