all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Standard Elisp debugger vs. Edebug
@ 2015-05-05 21:52 Marcin Borkowski
  2015-05-05 22:13 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marcin Borkowski @ 2015-05-05 21:52 UTC (permalink / raw
  To: Help Gnu Emacs mailing list

Hi all,

there are two Elisp debuggers built into Emacs: the "standard" debugger
and Edebug.

Edebug seems more powerful and easier to use.

The obvious question arises: is there any reason to use the standard
debugger at all?

My gut feeling is that while Edebug is nicer to use and more powerful,
there might be cases when it doesn't work.  For once, it seems that
there is no edebug-on-error option, and the only (?) way to use Edebug
to locate/examine errors is to manually step to the place where an error
occurs (or set up a breakpoint, temporary or otherwise, near the
suspicious location).  Even then, Edebug won't show me the backtrace,
for instance, and edebugging complicated code (in case I don't know
exactly where the error occurs) might be rather difficult/cumbersome.
So, the standard debugger at least helps to locate the error, and then
I can use Edebug to watch the code "live".  Am I right?

Another suspicion of mine is that the standard debugger is lower-level,
and it might be the case that some code (e.g., macros) will trip edebug
(since you have to use debug declarations in macro definitions - and
what if you have bugs in these?).  I would guess that using the standard
debugger might be easier with macro-heavy code, at least sometimes.  Am
I right?

Are there any other reasons to choose the standard debugger over Edebug?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: Standard Elisp debugger vs. Edebug
  2015-05-05 21:52 Standard Elisp debugger vs. Edebug Marcin Borkowski
@ 2015-05-05 22:13 ` Stefan Monnier
  2015-05-06  6:14 ` Tassilo Horn
  2015-05-06  8:38 ` Nicolas Richard
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-05-05 22:13 UTC (permalink / raw
  To: help-gnu-emacs

> The obvious question arises: is there any reason to use the standard
> debugger at all?

Yes, they have different strengths and weaknesses.  It would be great to
have a better debugger which combined the features of the two, but it
would require a very significant engineering effort.


        Stefan




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

* Re: Standard Elisp debugger vs. Edebug
  2015-05-05 21:52 Standard Elisp debugger vs. Edebug Marcin Borkowski
  2015-05-05 22:13 ` Stefan Monnier
@ 2015-05-06  6:14 ` Tassilo Horn
  2015-05-06  8:38 ` Nicolas Richard
  2 siblings, 0 replies; 4+ messages in thread
From: Tassilo Horn @ 2015-05-06  6:14 UTC (permalink / raw
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

Hi Marcin,

> there are two Elisp debuggers built into Emacs: the "standard"
> debugger and Edebug.
>
> Edebug seems more powerful and easier to use.
>
> The obvious question arises: is there any reason to use the standard
> debugger at all?

Yes, totally!  The standard debugger just works whereas with edebug you
already need to know which function(s) you are interested to debug and
then instrument them.  So I usually set `debug-on-error' or
`debug-on-quit' to be put in the standard debugger in case of an error
or quit/C-g (when debugging inf-loops or too long computation times).
From the backtrace I get then, I can narrow down the relevant functions
and then edebug them.  (Well, with some kinds of errors like wrong
number of args, there's even no need for edebugging anymore.)

Bye,
Tassilo



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

* Re: Standard Elisp debugger vs. Edebug
  2015-05-05 21:52 Standard Elisp debugger vs. Edebug Marcin Borkowski
  2015-05-05 22:13 ` Stefan Monnier
  2015-05-06  6:14 ` Tassilo Horn
@ 2015-05-06  8:38 ` Nicolas Richard
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Richard @ 2015-05-06  8:38 UTC (permalink / raw
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

Hi Marcin,

Marcin Borkowski <mbork@mbork.pl> writes:
>                        Even then, Edebug won't show me the backtrace,

Hit 'd' when in edebug to get a backtrace. That backtrace is less
powerful than the one you get with just (debug), but at least you have
function names, which you can then decide to instrument if you like.

> I would guess that using the standard
> debugger might be easier with macro-heavy code, at least sometimes.  Am
> I right?

It depends on what you're interested in debugging. e.g. if you
instrument the (defmacro) form, edebug will show you the steps while the
macro is being expanded (as well as the result of the expansion -- but
for this you have pp-macroexpand-last-sexp and the like).

e.g. if you C-u C-M-x on this:
(defmacro yf/foo ()
  `(progn ,(+ 2 2) t))

then eval (yf/foo)

edebug will show you that it evals (+ 2 2), and that the macro expands
to (progn 4 t) (which obviously evals to `t').

> Are there any other reasons to choose the standard debugger over
> Edebug?

C-h f debugger-mode RET shows what you can do in the debugger. FWIW I
often use these :
e               debugger-eval-expression
v               debugger-toggle-locals

-- 
Nico



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

end of thread, other threads:[~2015-05-06  8:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-05 21:52 Standard Elisp debugger vs. Edebug Marcin Borkowski
2015-05-05 22:13 ` Stefan Monnier
2015-05-06  6:14 ` Tassilo Horn
2015-05-06  8:38 ` Nicolas Richard

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.