[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New(?) idea for making backtraces usable: condition-case*

From: Eli Zaretskii
Subject: Re: New(?) idea for making backtraces usable: condition-case*
Date: Mon, 17 Jul 2023 19:12:15 +0300

> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]