From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#31671: 26.1; edebug-defun doesn't step if functions run in a separate thread Date: Mon, 04 Jun 2018 19:56:28 +0300 Message-ID: <83r2lmbidf.fsf@gnu.org> References: <87muwfsp4i.fsf@konghq.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1528131312 4133 195.159.176.226 (4 Jun 2018 16:55:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 4 Jun 2018 16:55:12 +0000 (UTC) Cc: 31671@debbugs.gnu.org To: Raimon Grau Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 04 18:55:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPsl9-0000yF-2Q for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Jun 2018 18:55:07 +0200 Original-Received: from localhost ([::1]:41038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPsnG-0006aY-7J for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Jun 2018 12:57:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPsn4-0006Yp-GW for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 12:57:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPsn1-0000tX-7R for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 12:57:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53902) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPsn1-0000tR-2r for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 12:57:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fPsn0-00016D-Rv for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 12:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Jun 2018 16:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31671 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31671-submit@debbugs.gnu.org id=B31671.15281313914172 (code B ref 31671); Mon, 04 Jun 2018 16:57:02 +0000 Original-Received: (at 31671) by debbugs.gnu.org; 4 Jun 2018 16:56:31 +0000 Original-Received: from localhost ([127.0.0.1]:33564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPsmU-00015E-T4 for submit@debbugs.gnu.org; Mon, 04 Jun 2018 12:56:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPsmT-00014z-SQ for 31671@debbugs.gnu.org; Mon, 04 Jun 2018 12:56:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPsmL-0000V3-FQ for 31671@debbugs.gnu.org; Mon, 04 Jun 2018 12:56:24 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPsmL-0000Uz-BT; Mon, 04 Jun 2018 12:56:21 -0400 Original-Received: from [176.228.60.248] (port=2553 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fPsmK-0003Fu-Pe; Mon, 04 Jun 2018 12:56:21 -0400 In-reply-to: <87muwfsp4i.fsf@konghq.com> (message from Raimon Grau on Thu, 31 May 2018 18:37:17 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146961 Archived-At: > From: Raimon Grau > Date: Thu, 31 May 2018 18:37:17 +0100 > > Using edebug-defun to instrument a function and running that function in > a separate thread using `make-thread' makes triggers the breakpoint but > leaves the bufer in read-only-mode but the user can't interact with > edebug in any way. > > Steps to reproduce (ubuntu 16.04): > - start emacs with emacs -Q . > - in the *scratch* buffer, write: > (defun foo () > (message "hi")) > > (make-thread 'foo) > - edebug-defun function foo > - c-x c-e the (make-thread 'foo) sexp > - *scratch* buffer point moves to the beginning of function foo > - press `n` and the minibuffers says: "No catch for tag: exit, nil". The > whole buffer is in read-only mode. modeline has > "(Lisp Interaction *Debugging* ElDoc)" The problem here is that Edebug enters recursive-editing (on the non-main thread which runs the function 'foo'), then waits for the user to press a key. While it waits, it releases the global lock, and the main thread starts running. So when you press a key, you are on a different thread, and 'throw' doesn't have a matching 'catch' (because that 'catch' is stored with the handlers of the thread which runs 'foo'. Not yet sure how to deal with this. Thoughts and ideas are welcome.