From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic307-54.consmr.mail.ir2.yahoo.com (sonic307-54.consmr.mail.ir2.yahoo.com [87.248.110.31]) by sourceware.org (Postfix) with ESMTPS id C6B223858CDA for ; Thu, 1 Dec 2022 19:06:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C6B223858CDA Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=yahoo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1669921607; bh=XHjzd3orGCUAY11Cg4Jvl/GXRbEHXzdAmUtOq1uXju8=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject:Reply-To; b=e+grL4gzso/Zmz6AFiLDBQf9fbw4BGEqnqMS84OGJkV4AqPriqqZkPlSQddF+ftUxpF1f0uKvJBjfOW5BBCN/wGbzNTBEjZLFqHWFt4WKg+jP3K+eYLh/4dIzfXmww+CKccnoWm11jfLSfsvENxoAGsRsd2y6/Bv8OYyxGwP9f733jpBziIJPyokuZemm6GhvVwgsysNXrbwuYfDlU2VYiL+3hmbQ3ZEfnbhxS8/ukblxj0xT89IT57aGgYOGsV3WYtD3c/nkVw1K6hnOfj0vQPIdoxl8Ct4DPFKUuFxnTk3cmMPCjxsfU3VjzFuUSK0Kn+tjkqjVlQYEroQYrHGCQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1669921607; bh=gj8sjF5nb+cw9Y3l1EKZN+mAbJ31jpH9mjhEZfNEOoH=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=Ix9Pklhek3DSXKren+5I65tUQzawgvwxM+OEZMxJGcgncrJ4os2ALBwl9ndSO7QAhSXhFj2djaAGfJ3o3GG/qokEPOJJCVf8vY1M+VmsO7GC5CtvJlZ8ND1WkuWxsFQz1oHzTFnGUX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xJdJldC_jQw1ZUccm055aS6QhyP7W3D Po3mjcRhn1t1Uj.lcv9jOg5d52xfOepTcNUbRS2rlP1JRApaNpG1q9ZsU6tSTTU7YHMiazHvDsJ8 .jUEusPkJqlHcz6_vo3cp2i0.qfnXQ2R9SIW5e2HbwBSW0_CIOMrKdrWkF9Q5oEFOlvF6O3gSt88 _fyjK0hDTQXPheyJQig2nJCHD5R3F2qevhmNo6Y7HSSCcEPPj.uYNPdfoH60BJsxmGjkbcQaM2Aw lCOaBzHaMQob7apw2wSEedgvKM9pZLeazC.uH9VS4x7oGU2sBMcrtCdWJfjtIje4mJ_0_33MauB5 dCIaqxu9y1wBF X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ir2.yahoo.com with HTTP; Thu, 1 Dec 2022 19:06:47 +0000 Date: Thu, 1 Dec 2022 19:06:42 +0000 (UTC) From: Hannes Domani To: Hannes Domani via Gdb-patches , Tom Tromey Message-ID: <1754067492.12464828.1669921602659@mail.yahoo.com> In-Reply-To: <87edtjm3pm.fsf@tromey.com> References: <20221128191526.1426-1-ssbssa.ref@yahoo.de> <20221128191526.1426-1-ssbssa@yahoo.de> <87edtjm3pm.fsf@tromey.com> Subject: Re: [PATCH] [RFC] Move SetConsoleCtrlHandler calls to async thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.20863 YMailNorrin X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: Am Donnerstag, 1. Dezember 2022, 18:30:33 MEZ hat Tom Tromey Folgendes geschrieben: > >>>>> "Hannes" =3D=3D Hannes Domani via Gdb-patches writes: > > Hannes> Ctrl-C and Ctrl-Break don't work any more since the async commit,= so I've tried > Hannes> to move the SetConsoleCtrlHandler calls. > Hannes> Now Ctrl-C seems to work, but Ctrl-Break completely stop both gdb= and the > Hannes> inferior (if new-console is disabled). > > Hannes> I'm not sure what's the proper fix is here, please advise. > > In my normal environment (ssh to a Windows machine), none of this has > ever worked at all.=C2=A0 I don't know why, something to do with ssh and/= or > cygwin. > > Anyway, I managed to test C-c by using remmina (RDP client) and then > running gdb in the console provided there.=C2=A0 I used conemu which I ga= ther > opened some kind of Cygwin shell. I'm not sure if C-c works the same inside of Cygwin. > According to winver this machine is "Windows Server 2016". > > I tried a few versions: > > 1. AdaCore internal gdb from before the target async patches.=C2=A0 (AdaC= ore >=C2=A0=C2=A0 has some local changes, but nothing relevant to this problem.= ) > > 2. AdaCore gdb corresponding to git master, plus your other recent >=C2=A0=C2=A0 windows-nat patches. > > 3. #2 plus your C-c patch. > > When I use "run" in gdb, control-c and control-break worked fine with 1 > and 2.=C2=A0 (FWIW I used the on-screen keyboard to send control-break, I > don't know any other way to do it.) > > When I use "attach", neither 1 nor 2 work at all -- but your patch does, > but only for C-c.=C2=A0 C-break just makes gdb exit. Yes, that C-break just exits gdb is the issue I meant, that didn't happen before. > Now, TBH, I find all of this surprising, because on seeing your patch, I > agree that the target async work should cause a problem here.=C2=A0 And, = I > don't understand why your patch fixes the "attach" behavior. > > With your patch installed, C-c still works, but C-break does not.=C2=A0 I > don't understand why this happens.=C2=A0 My understanding is that > SetConsoleCtrlHandler intercepts C-break as well, and the body of that > callback hasn't changed. > > One other thing I don't understand is that C-c doesn't cause gdb to exit > when it is waiting at the prompt.=C2=A0 Instead I get this quit message: > >=C2=A0=C2=A0=C2=A0=C2=A0 throw_quit ("Quit (expect signal SIGINT when the = program is resumed)"); I don't think I've ever seen this. When I press C-c on the gdb prompt, nothing at all happens, which is also what I expected. > Like, if this happens, do we really need ctrl_c_handler for the C-c case > at all?=C2=A0 (Maybe we do need the handler because windows-nat doesn't u= se > set_sigint_trap.)=C2=A0 And should gdb default to handling ctrl-break as > well?=C2=A0 Like, I wonder if there's a race between something like the c= all > to signal in child_terminal_inferior and installing the C-c handler. > > The comment in windows-nat says: > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [...]=C2=A0 There are two >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 possible situations: > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 - The debugge= r and the program do not share the console, in >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 w= hich case the Ctrl-c event only reached the debugger. >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 I= n that case, the ctrl_c handler will take care of >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 i= nterrupting the inferior.=C2=A0 Note that this case is >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 w= orking starting with Windows XP.=C2=A0 For Windows 2000, >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 C= trl-C should be pressed in the inferior console. > > Maybe the 'attach' issue is a known problem? > > Anyway.=C2=A0 I've learned that there's a lot in this area I don't > understand.=C2=A0 I think the first thing to do is understand why we get > different results.=C2=A0 I wonder what I could change here to reproduce t= he > problem.=C2=A0 Maybe I shouldn't be using conemu but instead something el= se? Note that it also makes a difference if you started a process with 'set new-console on' enabled (which is what I always have set). Hannes