unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12685: 24.2; lexical binding breaks edebug conditional breakpoints
@ 2012-10-19 19:18 Toby Cubitt
  2012-10-19 21:41 ` Stefan Monnier
  2013-07-26 16:09 ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Toby Cubitt @ 2012-10-19 19:18 UTC (permalink / raw)
  To: 12685

Conditional breakpoints whose condition refers to a lexically-scoped
variable fail with a "Symbol's value as variable is void" error.

This is almost certainly caused by the same issue as
http://thread.gmane.org/gmane.emacs.devel/150556 

That report mentioned that inspecting lexical variables during an edebug
session using M-: doesn't work. It seems worth pointing out that this
issue also makes conditional breakpoints almost useless. (The break
condition will depend on local variables 9 times out of 10.) I searched
and couldn't find an existing bug for this, so I'm creating one to track
the issue.

It seems to me that both these breakages are bugs, not just missing
features. The Edebug/Evaluation section of the Elisp manual contains:

  `M-: EXP <RET>'
       Evaluate expression EXP in the context of Edebug itself
       (`eval-expression').

I'm not clear on precisely what "in the context of Edebug itself" implies,
but it seems to me to strongly suggest that M-: should let you inspect
the values of local variables.

The Edebug/Breaks/Breakpoints section states:

    A "conditional breakpoint" tests a condition each time the program
  gets there.  Any errors that occur as a result of evaluating the
  condition are ignored, as if the result were `nil'.

The current behaviour definitely contradicts this. Not only does the
breakpoint not work, the error is not "ignored and treated as if the
result were nil", but instead aborts execution.

If this can't be fixed before the next release, at the very least the
Edebug section of the manual should be fixed to document that these
features currently don't work in lexically-scoped code. I'd advocate
fixing both bugs before the next release, even in feature-freeze, since
edebug is currently crippled in lexically-scoped code. But it seems clear
that this need C level changes, and I'm not expert enough to produce a
patch.



(Pedantic) steps to reproduce:

1. Create a file with the following contents:

==================================================
(defun test ()
  (let ((x 0)) (while (< x 10) (setq x (1+ x0)))))
==================================================

2. Open the file in a buffer, and do: "M-: (setq lexical-binding t)"
3. Instrument the function for edebug (C-u C-M-x)
4. Create a conditional breakpoint (C-x X x) anywhere inside the loop
5. Set the breakpoint condition: "(= x 5)"
6. M-: (test)


Emacs aborts executing the function with:

  Symbol's value as variable is void: x

The expected result is obviously for the function to run until x is
equal to 5.


Cheers,
Toby



In GNU Emacs 24.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-03 on c3po
Windowing system distributor `The X.Org Foundation', version 11.0.11202000
Configured using:
 `configure '--prefix=/usr' '--host=i686-pc-linux-gnu'
 '--mandir=/usr/share/man' '--infodir=/usr/share/info'
 '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib'
 '--disable-dependency-tracking' '--program-suffix=-emacs-24'
 '--infodir=/usr/share/info/emacs-24'
 '--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../../lib'
 '--with-gameuser=games' '--without-compress-info'
 '--disable-maintainer-mode' '--without-hesiod' '--without-kerberos'
 '--without-kerberos5' '--with-gpm' '--with-dbus' '--without-gnutls'
 '--without-xml2' '--without-selinux' '--without-wide-int'
 '--without-sound' '--with-x' '--without-ns' '--without-gconf'
 '--without-gsettings' '--with-toolkit-scroll-bars' '--without-gif'
 '--without-jpeg' '--without-png' '--without-rsvg' '--without-tiff'
 '--with-xpm' '--without-imagemagick' '--with-xft' '--without-libotf'
 '--without-m17n-flt' '--with-x-toolkit=gtk'
 'GENTOO_PACKAGE=app-editors/emacs-24.2' '--build=i686-pc-linux-gnu'
 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu'
 'CFLAGS=-march=prescott -O2 -pipe -O2' 'LDFLAGS=-Wl,-O1
 -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.utf-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

-- 
Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain

email: tsc25@cantab.net
web:   www.dr-qubit.org





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-08-09 11:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-19 19:18 bug#12685: 24.2; lexical binding breaks edebug conditional breakpoints Toby Cubitt
2012-10-19 21:41 ` Stefan Monnier
2012-10-20  1:08   ` Toby Cubitt
2012-10-23 16:33     ` Stefan Monnier
2012-10-23 17:10       ` Toby Cubitt
2012-10-23 18:27         ` Stefan Monnier
2012-10-23 18:39           ` Toby Cubitt
2012-10-24 13:55             ` Stefan Monnier
2013-07-26 16:09 ` Stefan Monnier
2013-08-05 15:14   ` Toby Cubitt
2013-08-05 17:27     ` Stefan Monnier
2013-08-08 23:19     ` Stefan Monnier
2013-08-09 11:02       ` Toby Cubitt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).