all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Toby Cubitt <tsc25@cantab.net>
To: 12685@debbugs.gnu.org
Subject: bug#12685: 24.2; lexical binding breaks edebug conditional breakpoints
Date: Fri, 19 Oct 2012 21:18:06 +0200	[thread overview]
Message-ID: <20121019191806.GA23820@c3po> (raw)

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	other threads:[~2012-10-19 19:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 19:18 Toby Cubitt [this message]
2012-10-19 21:41 ` bug#12685: 24.2; lexical binding breaks edebug conditional breakpoints 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121019191806.GA23820@c3po \
    --to=tsc25@cantab.net \
    --cc=12685@debbugs.gnu.org \
    --cc=toby-dated-1351883876.27e47e@dr-qubit.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.