* How do I get edebug online?
@ 2022-01-17 22:28 Davin Pearson
2022-01-17 22:46 ` Eric Abrahamsen
2022-01-17 23:55 ` Michael Heerdegen
0 siblings, 2 replies; 8+ messages in thread
From: Davin Pearson @ 2022-01-17 22:28 UTC (permalink / raw)
To: help-gnu-emacs
First I eval the following sexp:
(setq edebug-all-defs t)
Then I issue the following command on the following code which resides
in a file called:
~/java-training-wheels/dlisp/coolmacs/dmp-grep--splat-file.el.
The command is \C-\M-x. The file contains the following defun:
(defun fac (n)
(when (= 5 n)
(message "Foo bar")
(edebug)
(message "Rita Hayworth"))
(if (< 0 n)
(* n (fac (1- n)))
1))
Execute the following command:
(fac 10)
and it comes back at you with the following backtrace: (see after this
backtrace for my question)
Debugger entered: nil
apply(debug nil nil)
edebug()
(progn (message "Foo bar") (edebug) (message "Rita Hayworth"))
(if (= 5 n) (progn (message "Foo bar") (edebug) (message "Rita
Hayworth")))
fac(5)
(* n (fac (1- n)))
(if (< 0 n) (* n (fac (1- n))) 1)
fac(6)
(* n (fac (1- n)))
(if (< 0 n) (* n (fac (1- n))) 1)
fac(7)
(* n (fac (1- n)))
(if (< 0 n) (* n (fac (1- n))) 1)
fac(8)
(* n (fac (1- n)))
(if (< 0 n) (* n (fac (1- n))) 1)
fac(9)
(* n (fac (1- n)))
(if (< 0 n) (* n (fac (1- n))) 1)
fac(10)
eval((fac 10) nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
My question is this:
How do I go about typing g (goto next breakpoint)
Do I need to pop the stack and go back to the top level?
Do I enter the command g in the *Backtrace* window?
or in the file window
~/java-training-wheels/dlisp/coolmacs/dmp-grep--splat-file.el
How do I go about printing out "Rita Hayworth" ? I have searched my
*Messages* buffer but I have not found Rita Hayworth anywhere. Judging
from the Elisp manual it seems that I need to type in the "g" command but I
am perplexed at where I need to issue this command!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I get edebug online?
2022-01-17 22:28 How do I get edebug online? Davin Pearson
@ 2022-01-17 22:46 ` Eric Abrahamsen
2022-01-17 23:34 ` Michael Heerdegen
2022-01-17 23:55 ` Michael Heerdegen
1 sibling, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2022-01-17 22:46 UTC (permalink / raw)
To: help-gnu-emacs
Davin Pearson <davin.pearson@gmail.com> writes:
> First I eval the following sexp:
>
> (setq edebug-all-defs t)
>
> Then I issue the following command on the following code which resides
> in a file called:
> ~/java-training-wheels/dlisp/coolmacs/dmp-grep--splat-file.el.
> The command is \C-\M-x. The file contains the following defun:
>
> (defun fac (n)
> (when (= 5 n)
> (message "Foo bar")
> (edebug)
> (message "Rita Hayworth"))
> (if (< 0 n)
> (* n (fac (1- n)))
> 1))
You don't insert an actual call to (edebug) in your code (I didn't
actually know that was possible, and looking at the docstring it says it
works more or less like `debug', which is why you got the backtrack you
mention below).
Using `edebug-all-defs' always seemed clumsy to me, and likely to cause
an explosion of unwanted effects. I would leave that as nil, and then
just use the C-u prefix argument for C-M-x (`eval-defun'). That lets you
be much more targeted about what you instrument and what you don't.
Now, when you execute the function, edebug will halt execution right at
the beginning of the function, and hand over control to you and
keybindings like "g" and "SPC" and what have you. You don't need to
insert anything into the function definition itself.
HTH,
Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I get edebug online?
2022-01-17 22:46 ` Eric Abrahamsen
@ 2022-01-17 23:34 ` Michael Heerdegen
2022-01-17 23:44 ` Eric Abrahamsen
0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2022-01-17 23:34 UTC (permalink / raw)
To: help-gnu-emacs
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> You don't insert an actual call to (edebug) in your code (I didn't
> actually know that was possible, and looking at the docstring it says it
> works more or less like `debug', which is why you got the backtrack you
> mention below).
Not quite, see (info "(elisp) Source Breakpoints"). That requires the
containing function to be instrumented (which was not the case for the
OP). In uninstrumented code it indeed just calls `debug'.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I get edebug online?
2022-01-17 23:34 ` Michael Heerdegen
@ 2022-01-17 23:44 ` Eric Abrahamsen
2022-01-18 0:06 ` Michael Heerdegen
2022-01-18 0:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2022-01-17 23:44 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> You don't insert an actual call to (edebug) in your code (I didn't
>> actually know that was possible, and looking at the docstring it says it
>> works more or less like `debug', which is why you got the backtrack you
>> mention below).
>
> Not quite, see (info "(elisp) Source Breakpoints"). That requires the
> containing function to be instrumented (which was not the case for the
> OP). In uninstrumented code it indeed just calls `debug'.
Well that was the "more or less" :)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I get edebug online?
2022-01-17 22:28 How do I get edebug online? Davin Pearson
2022-01-17 22:46 ` Eric Abrahamsen
@ 2022-01-17 23:55 ` Michael Heerdegen
1 sibling, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2022-01-17 23:55 UTC (permalink / raw)
To: help-gnu-emacs
Davin Pearson <davin.pearson@gmail.com> writes:
> First I eval the following sexp:
>
> (setq edebug-all-defs t)
>
> Then I issue the following command on the following code which resides
> in a file called:
> ~/java-training-wheels/dlisp/coolmacs/dmp-grep--splat-file.el.
> The command is \C-\M-x. The file contains the following defun:
>
> (defun fac (n)
> (when (= 5 n)
> (message "Foo bar")
> (edebug)
> (message "Rita Hayworth"))
> (if (< 0 n)
> (* n (fac (1- n)))
> 1))
>
> Execute the following command:
>
> (fac 10)
>
> and it comes back at you with the following backtrace: (see after this
> backtrace for my question)
>
> Debugger entered: nil
> [...]
While I agree that in your situation it's more appropriate to call C-M-x
with prefix argument, your recipe should enable edebug nonetheless, so I
have reported your discovery as new Bug#53331. Hard to believe that
nobody ever reported this.
Thanks,
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I get edebug online?
2022-01-17 23:44 ` Eric Abrahamsen
@ 2022-01-18 0:06 ` Michael Heerdegen
2022-01-18 0:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2022-01-18 0:06 UTC (permalink / raw)
To: help-gnu-emacs
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Well that was the "more or less" :)
Ok :)
But jokes aside: it really can be useful - but it's better to make the
variable buffer local.
If you don't have a clue why and where something strange is happening,
it allows to instrument a whole buffer's definitions. Then you can set
edebug-global-break-condition to a sexp that checks whether the strange
things have started, and with some luck edebug drops you directly inside
the culprit. If not, hit "d" to check the callers and instrument some
more stuff.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I get edebug online?
2022-01-17 23:44 ` Eric Abrahamsen
2022-01-18 0:06 ` Michael Heerdegen
@ 2022-01-18 0:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-18 3:43 ` Eric Abrahamsen
1 sibling, 1 reply; 8+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-18 0:10 UTC (permalink / raw)
To: help-gnu-emacs
Eric Abrahamsen wrote:
>> containing function to be instrumented (which was not the
>> case for the OP). In uninstrumented code it indeed just
>> calls `debug'.
>
> Well that was the "more or less" :)
Is "more or less" the Swedish "mer eller mindre", meaning
pretty close or close enough a description of something, or
does it mean "både ock" which means both aspects are true but
in their own ways?
E.g.,
- Mr. Paul Anderson, when one speaks with you one gets the
impression that you always try to see both sides of
a problem?
- _________ <-- what should this be in English? It is "både
ock" in Swedish, "mer eller mindre" which is
literally "more or less" doesn't make sense,
well, it isn't fun anyway :))
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I get edebug online?
2022-01-18 0:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-01-18 3:43 ` Eric Abrahamsen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2022-01-18 3:43 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> Eric Abrahamsen wrote:
>
>>> containing function to be instrumented (which was not the
>>> case for the OP). In uninstrumented code it indeed just
>>> calls `debug'.
>>
>> Well that was the "more or less" :)
>
> Is "more or less" the Swedish "mer eller mindre", meaning
> pretty close or close enough a description of something, or
> does it mean "både ock" which means both aspects are true but
> in their own ways?
I think it's more like the former: an approximation that doesn't quite
fit with the facts, but close enough to be useful.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-18 3:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-17 22:28 How do I get edebug online? Davin Pearson
2022-01-17 22:46 ` Eric Abrahamsen
2022-01-17 23:34 ` Michael Heerdegen
2022-01-17 23:44 ` Eric Abrahamsen
2022-01-18 0:06 ` Michael Heerdegen
2022-01-18 0:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-18 3:43 ` Eric Abrahamsen
2022-01-17 23:55 ` Michael Heerdegen
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).