From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by sourceware.org (Postfix) with ESMTPS id 9003A3857838 for ; Wed, 12 Jul 2023 03:26:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9003A3857838 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=windriver.com Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36C2NnuC010849; Wed, 12 Jul 2023 03:26:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=PPS06212021; bh=5FijOU0ct5Glrq4N2p ArkADEAupZ0NztzllOK6iUgQw=; b=HEYgbZ5Gt0HS/WpjQZ+WbiRfdx3PrPFbAE +ANYKL8QXScUhMpGv0nmOtSqzX1Vx2yPAwOOUMc7CwA6yV8joVgMTSL38XaKP/Ji 3RdDxzVqarPZODTnCSFJHXWPP348dT2kDgAiC/FW92HgKCLH5ojOp2+kibViv1V2 xvFeL/d55NMNr4mWsEEPKDKPK+UHXWGiE0w/rshJx0gbpdEVVz4zfgy9KnP+Ft9A 1SPPPbaCzXWYXiaBDxz0Ch/UOY/hExByKL9xj+ivfRuxqfHJ5COf2HCODyvOIP87 OLo9fqKA5Akv/23b+XKM8Ohpt3+BUYTNPyRDhwDmOtdyh6Y3Fv2w== Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3rpw0wk71w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 12 Jul 2023 03:26:00 +0000 (GMT) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 11 Jul 2023 20:25:58 -0700 Received: from pek-lpd-ccm6.wrs.com (147.11.1.11) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Tue, 11 Jul 2023 20:25:57 -0700 From: To: CC: , , , Subject: [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step Date: Wed, 12 Jul 2023 11:25:56 +0800 Message-ID: <20230712032556.3110592-1-zhiyong.yan@windriver.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: sQgGQRsu50QYwv1BCqnKRXInld73Nx1h X-Proofpoint-GUID: sQgGQRsu50QYwv1BCqnKRXInld73Nx1h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_14,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=668 suspectscore=0 spamscore=0 priorityscore=1501 mlxscore=0 adultscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2305260000 definitions=main-2307120029 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Zhiyong Yan Gdb should not assume pending threads always generate “a non-gdbserver trap event”, for example “Signal 17” event could happen. Now that resume_stopped_resumed_lwps() -> may_hw_step() assumes that the break point must already exist, resume_one_thread() should ensure the software breaking point is installed although the thread is pending. Signed-off-by: Zhiyong Yan zhiyong.yan@windriver.com Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30387 --- gdbserver/linux-low.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index e6a39202a98..d29881174db 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -4671,7 +4671,16 @@ linux_process_target::resume_one_thread (thread_info *thread, proceed_one_lwp (thread, NULL); } else - threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread)); + { + threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread)); + if (thread->last_resume_kind == resume_step) + { + /* If resume_step is required by GDB, + install single-step breakpoint. */ + if (supports_software_single_step ()) + install_software_single_step_breakpoints (lwp); + } + } thread->last_status.set_ignore (); lwp->resume = NULL; -- 2.25.1