GNU bug report logs - #31671
26.1; edebug-defun doesn't step if functions run in a separate thread

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Raimon Grau <raimon@HIDDEN>; Keywords: confirmed; dated Thu, 31 May 2018 17:45:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) confirmed. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 31671 <at> debbugs.gnu.org:


Received: (at 31671) by debbugs.gnu.org; 5 Jun 2018 14:51:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 05 10:51:04 2018
Received: from localhost ([127.0.0.1]:35289 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fQDId-0001p9-Kj
	for submit <at> debbugs.gnu.org; Tue, 05 Jun 2018 10:51:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58365)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fQDIc-0001oe-3p
 for 31671 <at> debbugs.gnu.org; Tue, 05 Jun 2018 10:51:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fQDIT-0002Al-Q7
 for 31671 <at> debbugs.gnu.org; Tue, 05 Jun 2018 10:50:57 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45070)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fQDIT-0002Ah-LY; Tue, 05 Jun 2018 10:50:53 -0400
Received: from [176.228.60.248] (port=3872 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fQDIT-000306-1p; Tue, 05 Jun 2018 10:50:53 -0400
Date: Tue, 05 Jun 2018 17:51:03 +0300
Message-Id: <834lihb82w.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: raimon@HIDDEN
In-reply-to: <83r2lmbidf.fsf@HIDDEN> (message from Eli Zaretskii on Mon, 04
 Jun 2018 19:56:28 +0300)
Subject: Re: bug#31671: 26.1;
 edebug-defun doesn't step if functions run in a separate thread
References: <87muwfsp4i.fsf@HIDDEN> <83r2lmbidf.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 31671
Cc: 31671 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> Date: Mon, 04 Jun 2018 19:56:28 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> Cc: 31671 <at> debbugs.gnu.org
> 
> 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.

Any objections to the following band-aid?  (Of course, user-error does
nothing visible on non-main threads, and you have too invoke
thread-last-error to see the error message, but at least we don't
leave around a thread in limbo waiting forever for input that will
never come...)

--- src/thread.c~0	2018-01-28 06:56:25.000000000 +0200
+++ src/thread.c	2018-06-05 17:25:43.147566500 +0300
@@ -980,6 +980,23 @@ DEFUN ("thread-last-error", Fthread_last
   return last_thread_error;
 }
 
+DEFUN ("main-thread-p", Fmain_thread_p, Smain_thread_p, 0, 1, 0,
+       doc: /* Return non-nil if THREAD is the main thread.
+If THREAD is nil or omitted, it defaults to the current thread.  */)
+  (Lisp_Object thread)
+{
+  struct thread_state *tstate;
+
+  if (NILP (thread))
+    tstate = current_thread;
+  else
+    {
+      CHECK_THREAD (thread);
+      tstate = XTHREAD (thread);
+    }
+  return main_thread_p (tstate) ? Qt : Qnil;
+}
+
 
 
 bool
@@ -1073,6 +1090,7 @@ syms_of_threads (void)
       defsubr (&Scondition_mutex);
       defsubr (&Scondition_name);
       defsubr (&Sthread_last_error);
+      defsubr (&Smain_thread_p);
 
       staticpro (&last_thread_error);
       last_thread_error = Qnil;
--- lisp/emacs-lisp/edebug.el~0	2018-03-14 06:39:59.000000000 +0200
+++ lisp/emacs-lisp/edebug.el	2018-06-05 17:19:52.017355000 +0300
@@ -2425,6 +2425,8 @@
   (if inhibit-redisplay
       ;; Don't really try to enter edebug within an eval from redisplay.
       value
+    (or (main-thread-p)
+        (user-error "Debugging on non-main thread is not yet supported"))
     ;; Check breakpoints and pending input.
     ;; If edebug display should be updated, call edebug--display.
     ;; Return value.
--- lisp/emacs-lisp/debug.el~0	2018-01-03 13:08:56.000000000 +0200
+++ lisp/emacs-lisp/debug.el	2018-06-05 17:31:39.765134800 +0300
@@ -147,6 +147,8 @@
   (if inhibit-redisplay
       ;; Don't really try to enter debugger within an eval from redisplay.
       debugger-value
+    (or (main-thread-p)
+        (user-error "Debugging on non-main thread is not yet supported"))
     (unless noninteractive
       (message "Entering debugger..."))
     (let (debugger-value
--- doc/lispref/threads.texi~0	2018-01-03 13:08:46.000000000 +0200
+++ doc/lispref/threads.texi	2018-06-05 17:29:47.030735200 +0300
@@ -122,6 +122,12 @@
 Return the current thread.
 @end defun
 
+@defun main-thread-p &optional thread
+This function returns non-@code{nil} if @var{thread} is the main
+thread.  If @var{thread} is @code{nil} or omitted, it defaults to the
+current thread.
+@end defun
+
 @defun all-threads
 Return a list of all the live thread objects.  A new list is returned
 by each invocation.
--- etc/NEWS~	2018-03-14 06:39:58.000000000 +0200
+++ etc/NEWS	2018-06-05 17:37:13.301233500 +0300
@@ -361,6 +361,11 @@
 * Lisp Changes in Emacs 27.1
 
 +++
+** New primitive 'main-thread-p'.
+This can be used in code which needs to work differently when it runs
+in threads other than the main thread.
+
++++
 ** New function assoc-delete-all.
 
 ** 'print-quoted' now defaults to t, so if you want to see




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31671; Package emacs. Full text available.

Message received at 31671 <at> debbugs.gnu.org:


Received: (at 31671) by debbugs.gnu.org; 5 Jun 2018 14:47:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 05 10:47:53 2018
Received: from localhost ([127.0.0.1]:35278 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fQDFY-0001jI-RK
	for submit <at> debbugs.gnu.org; Tue, 05 Jun 2018 10:47:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57375)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fQDFW-0001j0-CJ
 for 31671 <at> debbugs.gnu.org; Tue, 05 Jun 2018 10:47:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fQDFN-0000eU-TJ
 for 31671 <at> debbugs.gnu.org; Tue, 05 Jun 2018 10:47:45 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45024)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fQDFN-0000eP-OR; Tue, 05 Jun 2018 10:47:41 -0400
Received: from [176.228.60.248] (port=3864 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fQDFN-0002ic-5t; Tue, 05 Jun 2018 10:47:41 -0400
Date: Tue, 05 Jun 2018 17:47:52 +0300
Message-Id: <83602xb887.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
In-reply-to: <b6ac5457-5353-4a73-9835-2c131d08398f@default> (message from Drew
 Adams on Mon, 4 Jun 2018 10:23:58 -0700 (PDT))
Subject: Re: bug#31671: 26.1; edebug-defun doesn't step if functions run in a
 separate thread
References: <<87muwfsp4i.fsf@HIDDEN>> <<83r2lmbidf.fsf@HIDDEN>>
 <b6ac5457-5353-4a73-9835-2c131d08398f@default>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 31671
Cc: raimon@HIDDEN, 31671 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> Date: Mon, 4 Jun 2018 10:23:58 -0700 (PDT)
> From: Drew Adams <drew.adams@HIDDEN>
> Cc: 31671 <at> debbugs.gnu.org
> 
> > 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.
> 
> Not really following this thread, and 100% unknowledgable
> about Emacs threading.  But somewhat curious: Does the same
> problem exist for plain `debug' as for `edebug'?

Yes.  Modify the recipe like this, and you have the same problem with
'debug':

  emacs -Q
  Type:

    (defun foo ()
      (message "Hi"))

  Eval the function to define it.
  M-x debug-on-entry RET foo RET
  M-: (make-thread 'foo) RET

  Type 'd' in the backtrace that Emacs presents.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31671; Package emacs. Full text available.

Message received at 31671 <at> debbugs.gnu.org:


Received: (at 31671) by debbugs.gnu.org; 4 Jun 2018 17:24:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 04 13:24:10 2018
Received: from localhost ([127.0.0.1]:33596 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fPtDG-0003kN-KD
	for submit <at> debbugs.gnu.org; Mon, 04 Jun 2018 13:24:10 -0400
Received: from aserp2130.oracle.com ([141.146.126.79]:35838)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1fPtDE-0003k8-Oj
 for 31671 <at> debbugs.gnu.org; Mon, 04 Jun 2018 13:24:09 -0400
Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1])
 by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w54HBAH8164621;
 Mon, 4 Jun 2018 17:24:02 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26;
 bh=qgIMlYvhJYxLpd0o+5eHk5LllkjxHMcnLqC0byJcyGY=;
 b=FzhvkWqPpjtPLblgG0jexh9k4+D1DgGIFOvrYuIYWQqU49spsdlVKMhWNFWjU2d3rN9B
 +J3/M3kFg5ftD4/4VOGV+PQJlPDGjtqQG3csFD80+WxHsqAGg/Y6dHQ0cFXYHpsbx9tU
 aFbDyDkWP2obPesNrE7QlNBJSaLkVe6rlyybg2h2ziDxTD/64JhfO9Oa2CSuckoI8HDF
 MKrqQn5MZEmUO57eJAym+V1W4+83xFc3BTmFX91aDd16mq05WqyHrikgW37ck21Hio/Z
 lshrEiKPjX+AOIwTiLOhG9w+Nq6XvENijedhqehoYxLGxWyJd29CI4uyrQjfS8kcASQB EQ== 
Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233])
 by aserp2130.oracle.com with ESMTP id 2jbvynvgev-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Mon, 04 Jun 2018 17:24:02 +0000
Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75])
 by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w54HO1Ii001687
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Mon, 4 Jun 2018 17:24:01 GMT
Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14])
 by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w54HO05h023143;
 Mon, 4 Jun 2018 17:24:00 GMT
MIME-Version: 1.0
Message-ID: <b6ac5457-5353-4a73-9835-2c131d08398f@default>
Date: Mon, 4 Jun 2018 10:23:58 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, Raimon Grau <raimon@HIDDEN>
Subject: RE: bug#31671: 26.1; edebug-defun doesn't step if functions run in a
 separate thread
References: <<87muwfsp4i.fsf@HIDDEN>> <<83r2lmbidf.fsf@HIDDEN>>
In-Reply-To: <<83r2lmbidf.fsf@HIDDEN>>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4690.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8914
 signatures=668702
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1805220000 definitions=main-1806040200
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 31671
Cc: 31671 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> 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'.
>=20
> Not yet sure how to deal with this.  Thoughts and ideas are welcome.

Not really following this thread, and 100% unknowledgable
about Emacs threading.  But somewhat curious: Does the same
problem exist for plain `debug' as for `edebug'?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31671; Package emacs. Full text available.

Message received at 31671 <at> debbugs.gnu.org:


Received: (at 31671) by debbugs.gnu.org; 4 Jun 2018 16:56:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 04 12:56:31 2018
Received: from localhost ([127.0.0.1]:33564 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fPsmU-00015E-T4
	for submit <at> debbugs.gnu.org; Mon, 04 Jun 2018 12:56:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49504)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fPsmT-00014z-SQ
 for 31671 <at> debbugs.gnu.org; Mon, 04 Jun 2018 12:56:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fPsmL-0000V3-FQ
 for 31671 <at> debbugs.gnu.org; Mon, 04 Jun 2018 12:56:24 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52974)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fPsmL-0000Uz-BT; Mon, 04 Jun 2018 12:56:21 -0400
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 <eliz@HIDDEN>)
 id 1fPsmK-0003Fu-Pe; Mon, 04 Jun 2018 12:56:21 -0400
Date: Mon, 04 Jun 2018 19:56:28 +0300
Message-Id: <83r2lmbidf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Raimon Grau <raimon@HIDDEN>
In-reply-to: <87muwfsp4i.fsf@HIDDEN> (message from Raimon Grau on Thu, 31
 May 2018 18:37:17 +0100)
Subject: Re: bug#31671: 26.1;
 edebug-defun doesn't step if functions run in a separate thread
References: <87muwfsp4i.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 31671
Cc: 31671 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> From: Raimon Grau <raimon@HIDDEN>
> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31671; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 31 May 2018 17:44:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 31 13:44:02 2018
Received: from localhost ([127.0.0.1]:56257 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fORcI-00008o-1L
	for submit <at> debbugs.gnu.org; Thu, 31 May 2018 13:44:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45709)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raimon@HIDDEN>) id 1fORWc-0008Ly-GE
 for submit <at> debbugs.gnu.org; Thu, 31 May 2018 13:38:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <raimon@HIDDEN>) id 1fORWW-0001Ek-0Q
 for submit <at> debbugs.gnu.org; Thu, 31 May 2018 13:38:05 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:41818)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <raimon@HIDDEN>) id 1fORWV-0001EQ-Sq
 for submit <at> debbugs.gnu.org; Thu, 31 May 2018 13:38:03 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36677)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <raimon@HIDDEN>) id 1fORWU-0006aa-6W
 for bug-gnu-emacs@HIDDEN; Thu, 31 May 2018 13:38:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <raimon@HIDDEN>) id 1fORWP-00016k-H8
 for bug-gnu-emacs@HIDDEN; Thu, 31 May 2018 13:38:02 -0400
Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:37354)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <raimon@HIDDEN>) id 1fORWO-00015m-Uy
 for bug-gnu-emacs@HIDDEN; Thu, 31 May 2018 13:37:57 -0400
Received: by mail-wm0-x242.google.com with SMTP id l1-v6so55487059wmb.2
 for <bug-gnu-emacs@HIDDEN>; Thu, 31 May 2018 10:37:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konghq.com; s=google;
 h=from:to:subject:date:message-id:mime-version;
 bh=JS+S2tMAgDr7tjof8YL45DRqIfb5BCU8GsRKDqPrFeY=;
 b=bqEFILE5/HBBC9KSXgeBM4u3kBlW3OeTJt6/jf0i3wlu6+ZxJxXNKInzrEInyo9OIi
 w8Pt8uK03htgwFo5EPDpPOBEbrEDpXtVOSmFwTHEbBucbqWFF5jwZDjT9NMI7nyTCy8V
 VYck4MZ97IL7Gtwx1yTkZygowTs4qzw8hQe4M=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=JS+S2tMAgDr7tjof8YL45DRqIfb5BCU8GsRKDqPrFeY=;
 b=icJOz0sU5tuhS+Kv09a+HzpTU+9ExT9nsGTBvsE9+8CvDRG0LOD4LudPvZHtYjVMw0
 gC+HiQNc8tjNgFoXjxUQRnaCTWHVPmgg9CwBBpaagE8KbD26cMqH8+DIUE03DN6NsWGn
 hnHsv0koSQhyb54xZ6rhKjh1vtapkR5KqgAqp+wJD4x3ewmoqpyf3W5Yc59s0o4CrCQC
 TCcwRWlhibwBNJFPCz/53cSFUEk7K2LqwRupGHDyXM5OEgAnrx7GYnDoJWDPbxyzsY+D
 zILiRazbtAMaeaTODXZ8IwPo/E6N0Lk+Tl+5ROl/a5CpB/xIBIzrY+OF6h9g8c0qI4Wm
 hkHg==
X-Gm-Message-State: APt69E1R1/5bxMFusj1GCeVHIf9az4o5uOWTMn80TnWJ2lmUdpGad/Cd
 0wPiruGHHh3yMPQHzWBZc3kEHACaxDk=
X-Google-Smtp-Source: ADUXVKJnRJBH+4YQy6K4isHfNH4rkhHIpd1BgTN6DFVCZeZ2b6aWfDJOdvy62fcEeXEH31wgDtSXxw==
X-Received: by 2002:a1c:14d4:: with SMTP id
 203-v6mr501746wmu.130.1527788275378; 
 Thu, 31 May 2018 10:37:55 -0700 (PDT)
Received: from raikong (81.61.106.180.dyn.user.ono.com. [81.61.106.180])
 by smtp.gmail.com with ESMTPSA id c53-v6sm29276863wrg.12.2018.05.31.10.37.54
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 31 May 2018 10:37:54 -0700 (PDT)
From: Raimon Grau <raimon@HIDDEN>
X-Google-Original-From: Raimon Grau <raimonster@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.1; edebug-defun doesn't step if functions run in a separate thread
Date: Thu, 31 May 2018 18:37:17 +0100
Message-ID: <87muwfsp4i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 31 May 2018 13:44:00 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

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 "Recent messages" below correspond exactly to that sequence of
commands.


In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2018-05-10 built on raikong
Repository revision: 1d9e66aea17787e03954f32c6cd7561c881bb444
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description:	Ubuntu 16.04.4 LTS

Recent messages:
foo
Edebug: foo
foo
#<thread 0x1399d20>

edebug-set-mode: No catch for tag: exit, nil
Making completion list...
(#<thread 0xc11460> #<thread 0x1399d20>)
Making completion list... [2 times]
Edebug will stop after next eval.
edebug-bounce-point: Edebug is not active
command-execute: Buffer is read-only: #<buffer *scratch*>

Configured using:
 'configure --prefix=/home/rgrau/emacs-git
 PKG_CONFIG_PATH=/home/rgrau/.guix-profile/lib/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LCMS2

Important settings:
  value of $LC_MONETARY: es_ES.UTF-8
  value of $LC_NUMERIC: es_ES.UTF-8
  value of $LC_TIME: es_ES.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  edebug-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils edebug easymenu cl-loaddefs cl-lib
elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 97842 12105)
 (symbols 48 20713 1)
 (miscs 40 59 143)
 (strings 32 29196 1060)
 (string-bytes 1 768686)
 (vectors 16 14550)
 (vector-slots 8 496991 7738)
 (floats 8 53 323)
 (intervals 56 254 7)
 (buffers 992 12)
 (heap 1024 32030 1223))




Acknowledgement sent to Raimon Grau <raimon@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#31671; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 21 Jun 2018 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.