From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: New(?) idea for making backtraces usable: condition-case*
Date: Wed, 19 Jul 2023 20:35:06 +0000 [thread overview]
Message-ID: <ZLhI-qU8uhRX4fbX@ACM> (raw)
In-Reply-To: <83ttu27c0w.fsf@gnu.org>
Hello, Eli.
On Mon, Jul 17, 2023 at 19:12:15 +0300, Eli Zaretskii wrote:
> > Date: Mon, 17 Jul 2023 13:52:20 +0000
> > From: Alan Mackenzie <acm@muc.de>
> > Hello, Emacs.
> > condition-case's are an unfortunate fact of Emacs life - Typically, when
> > a signal is signalled to indicate a bug in the called code, the condition
> > case unavoidably discards the most useful part of the backtrace. This
> > conundrum gave rise (I think) to bug #50629 "hard to debug an uncaught
> > error with ert" raised by Mike Kupfer on 2021-09-16.
> > My idea here is to write a new special form, condition-case*. This would
> > behave the same as condition-case unless a signal is signalled. In that
> > case the error handler forms would evaluate _before_ the specpdl gets
> > unwound. This unwinding would take place on exiting an error handler in
> > the form. The unwinding would NOT happen if the error handler is exited
> > with, say, signal. This would give nested condition-case*'s the chance
> > to output a full backtrace.
> > In the event of generating a backtrace, the entire stack at the point of
> > failure would get output.
> > Possibly, a new function unwind-stack might be needed, so that an error
> > handler can unwind the stack explicitly. I haven't thought this through,
> > yet.
> > The implementation should be relatively straightforward, extending the
> > existing mechanisms in eval.c.
> > Once it's working, large numbers of condition-case's could be replaced by
> > condition-case*, easing large amounts of debugging.
> > What do people think?
> I don't think I understand what will this give us that we don't
> already have with the following three existing features:
> . setting debug-on-signal non-nil
> . using 'debug' among the condition-case's conditions
> . using condition-case-unless-debug
Maybe not very much.
I've tried using debug-on-signal, but it triggers just too often to be
helpful.
I didn't know that one can usefully put `debug' in a condition-case
condition (which is what condition-case-unless-debug does). So, thanks
for the education!
But we only have 33 uses of condition-case-unless-debug as against 1661
of condition-case. There're probably a lot of the latter that could
usefully be changed into the former.
Anyhow, I withdraw my proposal for condition-case*.
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2023-07-19 20:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 13:52 New(?) idea for making backtraces usable: condition-case* Alan Mackenzie
2023-07-17 16:12 ` Eli Zaretskii
2023-07-19 2:19 ` Richard Stallman
2023-07-19 20:35 ` Alan Mackenzie [this message]
2023-07-20 4:41 ` Eli Zaretskii
2023-07-21 2:42 ` Richard Stallman
2023-07-21 5:55 ` Eli Zaretskii
2023-07-21 5:59 ` Ihor Radchenko
2023-07-19 2:19 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2023-07-18 4:38 Gerd Möllmann
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=ZLhI-qU8uhRX4fbX@ACM \
--to=acm@muc.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.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.