[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH]: Re: Early backtrace.
From: |
Stefan Monnier |
Subject: |
Re: [PATCH]: Re: Early backtrace. |
Date: |
Sun, 30 Jan 2022 11:31:30 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Alan Mackenzie [2022-01-30 11:07:32] wrote:
>> Namespace prefixes don't need to be created before we use them.
>> The point is just that `debugger-` is already used by definitions (in
>> `debug.el`) so we can reuse that space instead of messing up pristine
>> real estate.
> OK, I've called it debug-early.
Deal!
> Are there any objections to me committing this to master?
See my comments below.
> /* If we're in batch mode, print a backtrace unconditionally to help
> - with debugging. Make sure to use `debug' unconditionally to not
> - interfere with ERT or other packages that install custom
> - debuggers. Don't try to call the debugger while dumping or
> - bootstrapping, it wouldn't work anyway. */
> + with debugging. Make sure to use `debug-early' unconditionally
> + to not interfere with ERT or other packages that install custom
> + debuggers. */
This is not your fault, but I notice that this comment doesn't explain
how we distinguish the case where we want to print a backtrace from the
case where we want to call ERT's "debugger", both of which can occur in
batch mode.
> (defalias 'debug-early-backtrace
> #'(lambda ()
> "Print a trace of Lisp function calls currently active.
> The output stream used is the value of `standard-output'.
>
> This is a simplified version of the standard `backtrace'
> function, intended for use in debugging the early parts
> of the build process."
> (princ "\n")
> (mapbacktrace
> #'(lambda (evald func args _flags)
> (let ((args args))
> (if evald
> (progn
> (princ " ")
> (prin1 func)
> (princ " (")
> (while args
> (prin1 (car args))
> (setq args (cdr args))
> (if args
> (princ " ")))
> (princ ")\n"))
> (while args
> (princ " ")
> (prin1 (car args))
> (princ "\n")
> (setq args (cdr args)))))))))
>
> (defalias 'debug-early
> #'(lambda (&rest args)
> "Print a trace of Lisp function calls currently active.
> The output stream used is the value of `standard-output'.
>
> There should be two ARGS, the symbol `error' and a cons of
> the error symbol and its data.
>
> This is a simplified version of `debug', intended for use
> in debugging the early parts of the build process."
> (princ "\nError: ")
> (prin1 (car (car (cdr args)))) ; The error symbol.
> (princ " ")
> (prin1 (cdr (car (cdr args)))) ; The error data.
> (debug-early-backtrace)))
I'm curious: why did you split this into two functions?
> (setq debugger #'debug-early)
Could we make `debug-early` the default/initial value of `debugger` in
the C code, so that reloading `debug-early.el` can be done safely?
Stefan
- Early backtrace., Alan Mackenzie, 2022/01/10
- Re: Early backtrace., Stefan Monnier, 2022/01/10
- Re: Early backtrace., Alan Mackenzie, 2022/01/11
- Re: [PATCH]: Re: Early backtrace., Philipp Stephani, 2022/01/31
- Re: [PATCH]: Re: Early backtrace., Eli Zaretskii, 2022/01/31
- Re: [PATCH]: Re: Early backtrace., Alan Mackenzie, 2022/01/31
- Re: [PATCH]: Re: Early backtrace., Alan Mackenzie, 2022/01/31