From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 99ED53858CD1 for ; Fri, 26 Apr 2024 20:28:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99ED53858CD1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 99ED53858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714163307; cv=none; b=KFoAmB/m4sBcMd1XJXLczFvPHXzpJykWJ0Kjbmn+B8QqWwMea37GUqBhWkSM95IKobuP/fB3EhRsIs8+yboU2Ia7TzL3TFbjU/fbmFHm7hHREhixep1ZH56eR1bc3iZBzoxbgpuo8okGfikhRInVTW5ip4aaxXCIFENDCvqE4To= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714163307; c=relaxed/simple; bh=Jbn8wz8uo+6sXZKbT6YOCYqBoVszaYMIbv8le3kb0WI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ANqEpDwY2Hqj/3CHPn6SOYwyYwKiCQE57dPrv8I4jchfdtWSAzQZrAQLlalyPb5SAYrBsc7gJXVyMT8oOT70662ucE/WEwPCYidR0SfacI3akLcctihmZLPbrH+HxEihdo4PJBh/9ce8jTrwx1HywNhdjl5znTnPksR1nIblKtU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6009a.ext.cloudfilter.net ([10.0.30.184]) by cmsmtp with ESMTPS id 01hHsNgDFPM1h0SBEsxrNi; Fri, 26 Apr 2024 20:28:24 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 0SBDsTRuCnNCO0SBEsnDKz; Fri, 26 Apr 2024 20:28:24 +0000 X-Authority-Analysis: v=2.4 cv=DKCJ4TNb c=1 sm=1 tr=0 ts=662c0e68 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=raytVjVEu-sA:10 a=Qbun_eYptAEA:10 a=pGLkceISAAAA:8 a=nYg2XAgfkdHHywXfxhoA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+a+Z6eBtjcu0jEM8sw3rgRZ3KMKEgRl6fQggwTQAq6I=; b=KQZ0qq6FGIUANKEwp44TIoq7mX qlgfcYl2qX0K0RIw7vyUhIiaPmvv+weJDlDe2BB5G5ND7mIm28q1CPmVabo0Q2ClFDxFK4Ra6DREn WczJrN5pAS+UMLak4asRIUgfY; Received: from 97-122-86-252.hlrn.qwest.net ([97.122.86.252]:55596 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1s0SBD-001fJn-1y; Fri, 26 Apr 2024 14:28:23 -0600 From: Tom Tromey To: Johan Sternerup Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Handle DAP "stepOut" request in outermost frame In-Reply-To: (Johan Sternerup's message of "Fri, 26 Apr 2024 20:32:13 +0200") References: <20240425172019.863412-1-johan.sternerup@gmail.com> <87jzklgwig.fsf@tromey.com> <87frv9gvxk.fsf@tromey.com> X-Attribution: Tom Date: Fri, 26 Apr 2024 14:28:22 -0600 Message-ID: <87le4zg97d.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.86.252 X-Source-L: No X-Exim-ID: 1s0SBD-001fJn-1y X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-86-252.hlrn.qwest.net (murgatroyd) [97.122.86.252]:55596 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfIv0D0puSAe/K2ZGW2BOuxqfYempJOtLeLRnhjEpQwDvA/3rpLKzjt/ERNYK77HwEv+IxIWBwBAYcPDXvTzuga7glZInBOqrTrQCF+lYPUYyOodav/qv 1SNtFkstM8rsqXlgehzGeGXLhtl72hT1kVq8go1g0ETNqmtVxA1Vqb1jWr+oWe7ZwslZV62B3ezr+ioXj+voXAEsaqbBN0MH/XI= X-Spam-Status: No, score=-3015.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Johan" == Johan Sternerup writes: Johan> I think your suggestion to use background execution makes a lot Johan> of sense. I'm not sure I've understood the details though. For Johan> all the stepping commands we would have a request with Johan> response=True and in_dap_thread=False, i.e. we would pass our Johan> stepping command with a '&' to the gdb thread while waiting for Johan> the response in the dap thread. Yes. Johan> Eventually the gdb thread would process the request and I guess Johan> immediately return any error or success. Only after the step Johan> request has been made can a stop event be triggered and since the Johan> gdb thread is busy handling the request the _on_stop shouldn't be Johan> allowed to run right? ... Johan> Are there maybe several gdb threads or are gdb events/commands Johan> not processed in an event loop? The tricky case is a classic race: the gdb thread continues the inferior, which immediately stops, causing gdb to emit a stop event, which then causes the DAP event listener to generate a DAP event -- all before the DAP function manages to return. So, somewhere we'd need a bit of code to ensure that stop events are delayed, when necessary. This might be as simple as always calling send_event_later, and then making send_event_later a little bit smarter so that it checks to see if a request is "in flight". That information might already be available due to the support for cancellation, though I'd have to re-read the code to check. The event-generating code is in events.py. It's a bit messy, I'm afraid. Tom