From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#45117: 28.0.50; process-send-string mysteriously exiting non-locally when called from timer Date: Wed, 09 Dec 2020 17:33:35 +0200 Message-ID: <83k0tr5700.fsf@gnu.org> References: <87h7ow4j4o.fsf@gmail.com> <83mtyo71dh.fsf@gnu.org> <877dps47ge.fsf@gmail.com> <83360g6xlt.fsf@gnu.org> <87im9b2pds.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31421"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45117@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 09 16:34:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kn1Tm-00083d-Gt for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Dec 2020 16:34:10 +0100 Original-Received: from localhost ([::1]:40064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kn1Tl-0004YW-9r for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Dec 2020 10:34:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kn1Tf-0004YB-89 for bug-gnu-emacs@gnu.org; Wed, 09 Dec 2020 10:34:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kn1Te-0002Jo-K9 for bug-gnu-emacs@gnu.org; Wed, 09 Dec 2020 10:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kn1Te-0002UG-FM for bug-gnu-emacs@gnu.org; Wed, 09 Dec 2020 10:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Dec 2020 15:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45117 X-GNU-PR-Package: emacs Original-Received: via spool by 45117-submit@debbugs.gnu.org id=B45117.16075280299538 (code B ref 45117); Wed, 09 Dec 2020 15:34:02 +0000 Original-Received: (at 45117) by debbugs.gnu.org; 9 Dec 2020 15:33:49 +0000 Original-Received: from localhost ([127.0.0.1]:35744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kn1TR-0002Tm-B8 for submit@debbugs.gnu.org; Wed, 09 Dec 2020 10:33:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kn1TP-0002TX-6t for 45117@debbugs.gnu.org; Wed, 09 Dec 2020 10:33:48 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49401) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kn1TJ-0002Do-V0; Wed, 09 Dec 2020 10:33:41 -0500 Original-Received: from [176.228.60.248] (port=2492 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kn1TI-0006dq-99; Wed, 09 Dec 2020 10:33:41 -0500 In-Reply-To: <87im9b2pds.fsf@gmail.com> (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Wed, 09 Dec 2020 11:24:47 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:195524 Archived-At: > From: João Távora > Cc: 45117@debbugs.gnu.org > Date: Wed, 09 Dec 2020 11:24:47 +0000 > > [ We've been CC-ing bug-gnu-emacs@gnu.org for a while. My fault, the > typical CC blunder. Wonder how debbugs was dealing with that so > gracefully tho. ] It should deal with this just fine, as long as you keep the same Subject line. > If I set breakpoints at _all_ places where we call sys_longjmp(), I risk > tearing down my X, which I did a couple of times. > > So I skip those "dangerous" breakpoints. I'm guessing one of the > interesting loci to break is unwind_to_catch in eval.c. Of course that > gets called every dang time a signal is thrown, so it's hard for me to > catch the precise situation, even if I set up nicely and then call M-x > redraw-display, and only then enable the breakpoint. AFAICT, the only relevant call to sys_longjmp is in eval.c. That is, if we think Emacs signals an error or otherwise throws to top-level. > It breaks near immediately, and the `bt` output I get is always from > some other function that expectedly signalled an error as part of its > normal control flow. One simple method of dealing with that is to make GDB continue immediately after hitting the breakpoint: break eval.c:NNNN commands > bt > continue > end (the ">" prompt is printed by GDB). Then you will have a lot of backtraces, but only the last one will be relevant. This simple method has a disadvantage that it slows down Emacs, and also produces a lot of possibly uninteresting stuff. > 1. I have to find a way to set the unwind_to_catch() breakpoint > conditional on some Elisp/near-elisp context, in this case something > inside the Elisp function sly-net-send() or Fprocess_send_string. > > Do you think setting a silly global in Fprocess_send_string() and > then checking that as the breakpoint condition would be a good idea? > Where would I reset the flag? Is there some C-version of > "unwind-protect"? The C version of unwind-protect is record_unwind_protect. But I think it will be easier to use an existing variable that is usually not touched. For example, you could piggy-back bidi-inhibit-bpa, which is normally nil. On the C level, this is a bool variable bidi_inhibit_bpa, which is normally zero. So, you could wrap the problematic Lisp fragment with (let ((bidi-inhibit-bpa t)) .... ) and then make the breakpoint conditional on that: break eval.c:NNNN if bidi_inhibit_bpa != 0 The advantage of this is that when the let-form unwinds, the variable will be automatically reset (again, if we believe the theory of signal/throw that cause the non-local exit). HTH