Subject: bug#31671: 26.1; edebug-defun doesn't step if functions run in a separate thread

From: Raimon Grau <[email-masked]>
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 "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))