unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Running until first unhandled error.
@ 2023-01-04  4:25 Davin Pearson
  2023-01-04  8:53 ` Jean Louis
  2023-01-04 11:03 ` Michael Heerdegen
  0 siblings, 2 replies; 3+ messages in thread
From: Davin Pearson @ 2023-01-04  4:25 UTC (permalink / raw)
  To: help-gnu-emacs

I am trying to get edebug online instead of checkpointing every
second line of code and in every buffer like so to narrow down
the source of the bug, i.e. an unhandled error message.

(message "&foo:100:")
(defun foo ()
  (message "&foo:101:")
  (setq abc 123)
  (message "&foo:102:")
  (foo)
  (message "&foo:103:")
  (bar)
  (message "&foo:104:")
  (setq def 456)
  (message "&foo:105:")
  )
(message "&foo:106:")

I eval a buffer using

(progn
  (mark-whole-buffer)
  (eval-buffer))

and it enters me into the *Debugger* as it should.

What I want to do is to run until the next unhandled error message,
but none of the *Debugger* keys seem to do this.  The Elisp
documentation is not very clear on this point.

Here are my edebug settings for you to help me debug
my code:

(progn
  (require 'debug)
  (require 'edebug)
  (setq edebug-all-defs t)
  (setq edebug-all-forms t)
  (setq edebug-on-error t)
  (edebug-eval-top-level-form)
  )

*Davin.*


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

* Re: Running until first unhandled error.
  2023-01-04  4:25 Running until first unhandled error Davin Pearson
@ 2023-01-04  8:53 ` Jean Louis
  2023-01-04 11:03 ` Michael Heerdegen
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Louis @ 2023-01-04  8:53 UTC (permalink / raw)
  To: Davin Pearson; +Cc: help-gnu-emacs

* Davin Pearson <davin.pearson@gmail.com> [2023-01-04 07:27]:
> I am trying to get edebug online instead of checkpointing every
> second line of code and in every buffer like so to narrow down
> the source of the bug, i.e. an unhandled error message.
> 
> (message "&foo:100:")
> (defun foo ()
>   (message "&foo:101:")
>   (setq abc 123)
>   (message "&foo:102:")
>   (foo)
>   (message "&foo:103:")
>   (bar)
>   (message "&foo:104:")
>   (setq def 456)
>   (message "&foo:105:")
>   )
> (message "&foo:106:")
> 
> I eval a buffer using
> 
> (progn
>   (mark-whole-buffer)
>   (eval-buffer))

You need not mark whole buffer if you wish to eval buffer.

> and it enters me into the *Debugger* as it should.
> 
> What I want to do is to run until the next unhandled error message,
> but none of the *Debugger* keys seem to do this.

Please see Edebug menu.

> Here are my edebug settings for you to help me debug
> my code:
> 
> (progn
>   (require 'debug)
>   (require 'edebug)
>   (setq edebug-all-defs t)
>   (setq edebug-all-forms t)
>   (setq edebug-on-error t)
>   (edebug-eval-top-level-form)
>   )

The above is too general, it is causing more problems than it should.

No comment for above. I can tell that if there is function to debug, I
use this workflow:

1. Go to `defun' or after and press C-u M-C-x as that immediately
   marks the function for edebug

2. When execution location comes to that function, I find myself in
   the function, then I press `n' to evaluate expressions one by one.

3. I may discover other function which is giving the error, at that
   time, go to other function and repeat steps 1, and remove the first
   function eventually with 
      {M-x edebug-remove-instrumentation RET name-of-first-function RET}

4. I repeat this process until I find what is wrong.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: Running until first unhandled error.
  2023-01-04  4:25 Running until first unhandled error Davin Pearson
  2023-01-04  8:53 ` Jean Louis
@ 2023-01-04 11:03 ` Michael Heerdegen
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2023-01-04 11:03 UTC (permalink / raw)
  To: help-gnu-emacs

Davin Pearson <davin.pearson@gmail.com> writes:

> I am trying to get edebug online instead of checkpointing every
> second line of code and in every buffer like so to narrow down
> the source of the bug, i.e. an unhandled error message.

Note that when Edebugged code errors the Edebug session technically ends
(since the debugged code isn't executed any more after an error
happened).

A good workflow is to turn on debug-on-error, then to look at the
backtrace for the currently called functions, then to instrument these
using Edebug.

Michael.




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

end of thread, other threads:[~2023-01-04 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04  4:25 Running until first unhandled error Davin Pearson
2023-01-04  8:53 ` Jean Louis
2023-01-04 11:03 ` 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).