From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: New(?) idea for making backtraces usable: condition-case*
Date: Mon, 17 Jul 2023 19:12:15 +0300 [thread overview]
Message-ID: <83ttu27c0w.fsf@gnu.org> (raw)
In-Reply-To: <ZLVHlI9OWr20rQkv@ACM> (message from Alan Mackenzie on Mon, 17 Jul 2023 13:52:20 +0000)
> 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
next prev parent reply other threads:[~2023-07-17 16:12 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 [this message]
2023-07-19 2:19 ` Richard Stallman
2023-07-19 20:35 ` Alan Mackenzie
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
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=83ttu27c0w.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=acm@muc.de \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).