From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by sourceware.org (Postfix) with ESMTPS id 1EBC83858D20 for ; Wed, 12 Jul 2023 03:30:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1EBC83858D20 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 (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36C3F2Ir018112; Tue, 11 Jul 2023 20:29:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:references:in-reply-to :content-type:content-transfer-encoding:mime-version; s= PPS06212021; bh=PtwVetF4N0eMLGg1QRcJyQCHGiDaqn58hNLcFuGHMIE=; b= ZSWJFwwLzukt22MA1gaXALv7/2o8bCZafmikJCvVrQA4s0Zmb3hrsrmJ2HmLACns 2C7TfVn3O9b4J5zNC07lGW+JEeqk1iC0f9KylLl4SMF/5Pf5/bcYhDvlObgFEDPD YL560Ydbc5dwIJldFv1Cb6qvF3Tq6Ok0FpOgqx0i2ZvDI28koKfoE+ZAlsm9dPDn Xo7FK8n7T/N3B4mCvhhJ3iDhzJve8++KPjrkJ2MOZ+yEiJBml3I08L0fuBgazzXK bgw2/VncvDrxY1cfbvokMmMrpb1Jf0+6sYQDncSZMTEsrllumtOJVKbszBd03WnT 1hoUp3YRctYtWhPTAndfgA== Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3rq7afaw8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jul 2023 20:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ClSwt+ps+yJYcLJKfy5MyfmT17z5F6p3HcP4M8uNRydUVLXI4Voz9d7ySnstn5mu21de9HwlKj6F3h9EXeoUAGJRTdRlbXaBw95JkZR6MPUcmYQ4vlD6rhHqDFPy4H/D79/T0dfzHSFiS7W0G2vY7WVSyrNG4wEzdk7x2KjarW8ruqyaMOPdwMkSOjG04/wpTIhbp8WeX5EIcdGcKjnsa9kOyyrWyUNtCjhES8z1OvRxH3pGB172rjIqNjLfNsmNmcYD8SS3KMVLp8Yv5/4NDWXL3QfvUTgeSIylsS6mp+LTCleW2Tzx/uhYkENdvupnRojWk7q//BB6lAvu2KpEYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PtwVetF4N0eMLGg1QRcJyQCHGiDaqn58hNLcFuGHMIE=; b=iGIwqO7fRl9eoTbfnrdZrmnjf0kPNFnbVC7yWcoPaa4mZiKlKw9SupTCwYeEYWSBLG8Cdc+rKShRiOg4LDAT2Rm3X/V6DGM5JBDo5M4M3rl2GmzWGLLeLoA1vtqt5Gn0xdPIPdpfflH3KPkk3HE/L6P5+8u+U557EaqunAwffFr62pWcnj50WpqhhZXVDKWZPe/+Gdh9vUWWETyiaeKs83LJKqrB5FsawZLgKCCptP93HjE1oSIlkTQxeRzGoH/UemEPcGV9mEVl1xM0GU8M3liggcjUeNNGQrIp7V5kb2qwXa2ZyWoTXL2IzQo3edpRZn+yistdVqC+b+0MbdNpUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DS0PR11MB6447.namprd11.prod.outlook.com (2603:10b6:8:c4::16) by IA0PR11MB8334.namprd11.prod.outlook.com (2603:10b6:208:483::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.26; Wed, 12 Jul 2023 03:29:52 +0000 Received: from DS0PR11MB6447.namprd11.prod.outlook.com ([fe80::526f:e467:bee5:cb4d]) by DS0PR11MB6447.namprd11.prod.outlook.com ([fe80::526f:e467:bee5:cb4d%4]) with mapi id 15.20.6565.028; Wed, 12 Jul 2023 03:29:51 +0000 From: "Yan, Zhiyong" To: Kevin Buettner CC: "gdb-patches@sourceware.org" , "tom@tromey.com" , "luis.machado@arm.com" Subject: RE: [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step Thread-Topic: [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step Thread-Index: AQHZrVsqgneJC1FcJ0KBxXYAgtmE+6+09EyAgACA6HCAABGdgA== Date: Wed, 12 Jul 2023 03:29:51 +0000 Message-ID: References: <20230703030458.1192525-1-zhiyong.yan@windriver.com> <20230711114034.5d2fe2cb@f37-zws-nv> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS0PR11MB6447:EE_|IA0PR11MB8334:EE_ x-ms-office365-filtering-correlation-id: f17352dd-5de3-438a-4874-08db8288408e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Pa3OGngW/Z98Vlo11dO+887WOdPkmcUl2gy1oxVIMjpjjuENEKkj+Nhsmdx7Seb9qtcU848ZX9eEmxJR8rL8He4mydFBuViTRRDGdRuPYB6QfBwmwxkeij1LRsu/di3DNoF8iQZ37B8N0C7On0qKHRSZG3iZX9FWYC+J4H6oaD/ZZU0S2hWqwRgq8yeqLJN74/A9PdJVgvGXwgTQ1g7zYJbo91lBzZSVrBwG/mRrFfNZJuzgCHM3C21xmPO8bL9KzZbERjYdnaeV6nPW94BALCmFHeLzmO3nE1kCzSF+ofAigGIBe4rSkkOVboOHwKVuWpKUTGPT/9VfyvmyC41i5PU1VogXQypq+A+TkSFEPWsg76JS0Fz8wF33TPu1plhK5ucz2NliwI/bJ/zBq7lNT+z6YOvrzLh7yM+y/dCz+7K99KNo34zzgqEjxzeJERqQWYgMyl/7QP6FHuPURoHus1384ObP5cPkz16TOG40kU+duI7SastPnSwMyw/p0V15nmW+47xzAipP7F+ZLPs8o5lbeVy5CygJ+46Jdo1+kMmP8f0gRq2b0VLX7ZmSH9WZnOQqVPCIBy8PylzZBRZBUdTMy5Lq3TU6dS7P1EZF28I= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB6447.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(366004)(136003)(396003)(39830400003)(451199021)(6916009)(66476007)(4326008)(66446008)(76116006)(64756008)(66946007)(66556008)(966005)(122000001)(38100700002)(186003)(86362001)(38070700005)(6506007)(26005)(53546011)(83380400001)(33656002)(9686003)(478600001)(7696005)(55016003)(54906003)(41300700001)(2940100002)(52536014)(5660300002)(8936002)(8676002)(71200400001)(2906002)(316002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pfEoeDXFNGTUVeWStV0HtAx7oFEpKR+aSmMCHYDAex3Tz+ArS0vYXhTg0oF1?= =?us-ascii?Q?olswMYRr6nr+zxAgc1Qp4tjz4F/IivYSXcqx/0yGvgPt8DHIs0hI4JxKVQ1x?= =?us-ascii?Q?zZtnfXTwTxwWCOTxyCYS67KgPyoGG1nq/CyqtSR7adBWyOTJQ1kX3invdXP7?= =?us-ascii?Q?0h8xsfZp3/M/3E7uJcQoHaQgWqdMMp0x0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9jEv3bCi13vyKsa2IQnfg2G0MFhb2j776uFNvOT/5UrLmS?= =?us-ascii?Q?8+Wq2XZxdQ4uC8jrXpxdsPx7Tb9Y9NsrrBRiWCl8dZF7nxj2C2cVHr7I9ETZ?= =?us-ascii?Q?wRxl0hRCLG/0o68bZNLwfbZ8hyYzh6jhXepYsWoWG1wDibZPUibhotnwPkwV?= =?us-ascii?Q?vNUqjWm0BrjSj3nIZkztAZ6hRHbRlUdYCyUqkxvO+Xv5Jn+AzSBWjlKT4jcY?= =?us-ascii?Q?oOw815ro8zCEmmRJtQvrU41OEedek7TgMFeMToEH6WBczX4UTFRo0HWdu1TO?= =?us-ascii?Q?Wk4YUSp3OzPR70VcOkWJfVmG57rAqjKHpw629EcX++sA4Fxc79NLbgnjsUi3?= =?us-ascii?Q?T/BYs9BQUkGYnMJfZiTAM/770h1z/H1Wegy/hnkwxzWya+4nzdQDlusn2nPn?= =?us-ascii?Q?CNpyHj+7NH4n6Njq7TWUQYKAJKuYPqxA3Z1nlV3ELnqG52BnCzEGQaTxoEDp?= =?us-ascii?Q?RaE7lK0mrTNRIZ1m3+64sjpb2zYXgfaadjCd0XKX?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB6447.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f17352dd-5de3-438a-4874-08db8288408e X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2023 03:29:51.2972 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZKNHr7qY4GItXDNxn8ZK/8BMq8hP8slg/ytGIIhY2r2e9jlT0LMJKcMEeMlpek9rZl9ZuwsNtT/J6oV/yMkDuMd7dlkhlZW3IP+aalZSSYo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB8334 X-Proofpoint-ORIG-GUID: I3YUcKtcfaaEtoSA1yuHXnb2W0C1bleP X-Proofpoint-GUID: I3YUcKtcfaaEtoSA1yuHXnb2W0C1bleP 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 priorityscore=1501 impostorscore=0 mlxscore=0 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=987 malwarescore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2305260000 definitions=main-2307120028 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,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: Hi all, For "format nit", I have sent new patch again. Because add more mail C= C, I send patch triple today, they same. Sorry for bothering you. Best Regards. Zhiyong -----Original Message----- From: Yan, Zhiyong=20 Sent: Wednesday, July 12, 2023 10:34 AM To: Kevin Buettner Cc: gdb-patches@sourceware.org; tom@tromey.com; luis.machado@arm.com Subject: RE: [PATCH] gdbserver: Install single-step breakpoint for a pendin= g thread whose last_resume_kind is resume_step Hi Kevin, My last mail's attachment is a little big, I am not sure if you can re= ceive it. I zipped the log, and send again. - For "format nit", I will work on it again. - For your concern "I'd like to understand the situation better befor= e approving it.", Please check attached " step5-assert.txt". Attached step5-assert.txt is a debug log which contains several "gd= b step next" output. For example, at line 29, resume_one_thread() doesn't call process_o= ne_lwp() because thread LWP 316.316 is pending, as a result the software b= reaking point is not installed. Later, if this pending thread makes "wait_1= : Hit a non-gdbserver trap event." happen, stop_all_lwps() -> "prepare_resu= me_reply: Writing resume reply for" ->... In such case, "gdb N" can finish without assert error.=20 But in step5-assert.txt, from line 14923 to 14943, we can see the p= ending thread make below happen, " wait_for_event_filtered: Got a pending child 316 362.994099 [threads] wait_for_event_filtered: Got an event = from pending child 316 (117f) 362.994379 [threads] wait_1: Ignored signal 17 for LWP 316 " In this case "resume_stopped_resumed_lwps" will resume every 'stop= ped-resumed' thread, but a thread (previously pending) has no software brea= k point installed, then resume_stopped_resumed_lwps() asserts failed in may= be_hw_step(). =20 Best Regards. Zhiyong -----Original Message----- From: Kevin Buettner Sent: Wednesday, July 12, 2023 2:43 AM To: Yan, Zhiyong Cc: gdb-patches@sourceware.org; tom@tromey.com; luis.machado@arm.com Subject: Re: [PATCH] gdbserver: Install single-step breakpoint for a pendin= g thread whose last_resume_kind is resume_step CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender and = know the content is safe. Hi Zhiyong, See my comments below; there's still one formatting nit, but I also have a = question about whether this is the right place to fix the bug that you're s= eeing. Also, I've added Luis to the CC list since he knows a lot more about the AR= M architecture than I do. On Mon, 3 Jul 2023 11:04:58 +0800 wrote: > From: Zhiyong Yan > > Gdb should not assume pending threads always generate "a non-gdbserver tr= ap event", for example "Signal 17" event could happen. Now that resume_stop= ped_resumed_lwps() -> may_hw_step() assumes that the break point must alrea= dy 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=3D30387 > --- > 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=20 > e6a39202a98..7d8bbf71ddc 100644 > --- a/gdbserver/linux-low.cc > +++ b/gdbserver/linux-low.cc > @@ -4671,7 +4671,16 @@ linux_process_target::resume_one_thread (thread_in= fo *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 =3D=3D resume_step) > + { > + /* If resume_step is required by GDB, > + install single-step breakpoint. */ > + if (supports_software_single_step()) Formatting nit: you need a space between 'supports_software_single_step' and the left paren. > + install_software_single_step_breakpoints (lwp); > + } > + } > > thread->last_status.set_ignore (); > lwp->resume =3D NULL; With regard to the change itself... If the debugging printf is accurate, the LWP is being left in a stopped sta= te. If that's the case, then why are software single step breakpoints bein= g inserted? It seems to me that you'd only want to insert these breakpoint= s when the thread is actually about to resume. That said, I have no doubt that this change works for you, so clearly there= 's something going on which I do not understand. I'd like to understand th= e situation better before approving it. Also, once you have an explanation= , please update the code comments and/or commit log message as appropriate.= My personal preference is for a concise explanation to be placed in the c= ode comments with any additional, longer winded explanations or examples be= ing placed in the commit log message. Kevin