bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12685: 24.2; lexical binding breaks edebug conditional breakpoints


From: Toby Cubitt
Subject: bug#12685: 24.2; lexical binding breaks edebug conditional breakpoints
Date: Fri, 19 Oct 2012 21:18:06 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]