unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Joel Reicher <joel.reicher@gmail.com>,
	Lewis Creary via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Cc: Lewis Creary <lewcreary@cs.com>
Subject: RE: [External] : Re: Learning Edebug
Date: Sat, 21 Dec 2024 18:44:47 +0000	[thread overview]
Message-ID: <DS7PR10MB52329754BE505F8DD40A312DF3002@DS7PR10MB5232.namprd10.prod.outlook.com> (raw)
In-Reply-To: <86frmhk1b0.fsf@gmail.com>

> instrumenting code is basically what you've been 
> doing with print statements. When edebug 
> instruments the code and inserts its own debugging
> snippets, you can execute the code normally and
> the instrumentation that edebug inserted will call 
> the edebug functionality.

In Elisp the equivalent of a print statement
is a `message' call:
  (message "foo value at position 42: %S" foo)

You can insert calls to `message' in your code 
anywhere, to provide trace-like behavior and
not invoke any debugger.

You can also invoke the (classic) Lisp debugger
by inserting breakpoints in your code anywhere.
These are just calls to function `debug'.

In the debugger, you can use the key `e' to
evaluate any Lisp expression _within the
context of the stack_, i.e., the current
control context.

As a shortcut, you can insert a `debug'
breakpoint that immediately evaluates a sexp
you pass to function `debug' as an argument,
saving you from typing it and hitting `e'.
If you just immediately hit `c', to continue
(exiting) the debugger that was just entered
(or `q' to quit), then This is akin to using 
`message' (or `error').

You pass the sexp to evaluate as the second
arg to `debug', using `nil' as the first:

  (debug nil (some-expression))

These are _ad hoc_ ways to get info at
particular places.  Easy to control (on/off
for particular breakpoints by commenting out 
their `debug' calls).



      reply	other threads:[~2024-12-21 18:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <130443705.1910512.1734664285448.ref@mail.yahoo.com>
2024-12-20  3:11 ` Learning Edebug Lewis Creary via Users list for the GNU Emacs text editor
2024-12-20  6:23   ` mbork
2024-12-20  7:18   ` Eduardo Ochs
2024-12-20  8:11   ` Joost Kremers
2024-12-20 11:36   ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-12-20 15:37     ` [External] : " Drew Adams
2024-12-20 22:46   ` tpeplt
2024-12-21  2:41     ` Eduardo Ochs
2024-12-21  6:17   ` Joel Reicher
2024-12-21 18:44     ` Drew Adams [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=DS7PR10MB52329754BE505F8DD40A312DF3002@DS7PR10MB5232.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=joel.reicher@gmail.com \
    --cc=lewcreary@cs.com \
    /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.
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).