all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: Eli Zaretskii <eliz@gnu.org>,  larsi@gnus.org,  emacs-devel@gnu.org
Subject: Re: Fontification error backtrace  [Was: Why is it so difficult to get a Lisp backtrace?]
Date: Sat, 02 Jul 2022 17:12:50 -0400	[thread overview]
Message-ID: <jwv35fjp6qf.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <YsCqNI8H0ZNVNWj0@ACM> (Alan Mackenzie's message of "Sat, 2 Jul 2022 20:27:32 +0000")

Alan Mackenzie [2022-07-02 20:27:32] wrote:
> Hello, Stefan.
> On Thu, Jun 30, 2022 at 16:34:23 -0400, Stefan Monnier wrote:
>> >> That's where we currently log all the errors during redisplay, since
>> >> Emacs 21.1.  So why this one is different?
>
>> > It's not a single line, or a small number of lines.  It could potentially
>> > be a stack overflow error, generating a large backtrace, which might have
>> > more lines than message-log-max.
>> How 'bout stashing the backtrace data in a var (without turning it into
>> text yet; that .....
> Does "that" mean the stashing or the turning into text?

It meant "stashing".

>> .... should always be quick, safe, and painless) and then adding a
>> button in the *Messages* (or *Warnings*) next to the error itself such
>> that pressing the buttong shows you the actual backtrace?
> I'm not sure the stashing of the backtrace data is a good idea.  It's
> likely to be BIG (see above), and it's fragile

I don't see the "above" that explains why you think it's going to
be BIG.  Neither do I understand why you think it would be fragile?

> - the only place to record it is in signal_or_quit, before it gets
> discarded by a call to unwind_to_catch.  The need to know its precise
> format is obviated by the C function mapbacktrace, so we might as well
> just dump out the backtrace as text in *Backtrace* at the first
> opportunity.  There's nothing time critical about the said dumping.

As I mentioned in another message, I think it would make sense to
"always" stash backtraces when we get an unhandled error, and then to
offer a way to investigate these "post mortem".  Think of it as Emacs's
equivalent of Unix's core dumps.

>> We could even try and get fancy: instead of only stashing the
>> `backtrace-frames`, we could also stash a copy of the specpdl so we
>> could bring up a *Backtrace* buffer which isn't quite "live" but can
>> still be used to some extent to see the values of local vars (and
>> `current-buffer`) in the different activation frames.
> I think that's very ambitious.

I don't think it's should be terribly hard.  We already support multiple
specpdl and switching between them for the purpose of threads, so most
of the delicate part of the code is already written.

>> BTW, in order to debug fontification errors, we also have
>> `jit-locak-debug-mode` which postpones the jit/font-lock execution from
>> within redisplay to "just a bit later" such that it can use the
>> debugger.  IIRC it still has some rough edges in some cases, but in
>> theory it should be possible to make this work such that you can (for
>> example) Edebug `font-lock.el` itself.
>
> It does work, though, doesn't it?

Yes.


        Stefan




  reply	other threads:[~2022-07-02 21:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 13:42 Why is it so difficult to get a Lisp backtrace? Alan Mackenzie
2022-06-25 15:26 ` Alan Mackenzie
2022-06-25 15:30   ` Stefan Kangas
2022-06-25 15:52     ` Alan Mackenzie
2022-06-25 16:27       ` Stefan Kangas
2022-06-25 15:35   ` Lars Ingebrigtsen
2022-06-25 15:59     ` Alan Mackenzie
2022-06-25 16:51       ` Eli Zaretskii
2022-06-25 19:45         ` Alan Mackenzie
2022-06-26  5:20           ` Eli Zaretskii
2022-06-27 19:48             ` Fontification error backtrace [Was: Why is it so difficult to get a Lisp backtrace?] Alan Mackenzie
2022-06-28 11:43               ` Lars Ingebrigtsen
2022-06-28 11:57               ` Eli Zaretskii
2022-06-28 17:28                 ` Alan Mackenzie
2022-06-28 18:17                   ` Eli Zaretskii
2022-06-28 19:31                     ` Alan Mackenzie
2022-06-29 19:00                       ` Eli Zaretskii
2022-07-12 19:48                         ` Redisplay hook error bactraces [Was: Fontification error backtrace] Alan Mackenzie
2022-07-13 12:33                           ` Eli Zaretskii
2022-07-13 18:41                             ` Redisplay hook error backtraces Alan Mackenzie
2022-07-13 19:00                               ` Eli Zaretskii
2022-07-13 20:12                                 ` Alan Mackenzie
2022-07-13 20:49                                   ` Stefan Monnier
2022-07-14  5:12                                   ` Eli Zaretskii
2022-07-14  9:01                                     ` Alan Mackenzie
2022-07-14  9:10                                       ` Eli Zaretskii
2022-07-14 13:42                                         ` Alan Mackenzie
2022-07-14 13:59                                           ` Eli Zaretskii
2022-07-14 16:07                                             ` Alan Mackenzie
2022-07-14 16:18                                               ` Stefan Monnier
2022-07-14 19:47                                                 ` Alan Mackenzie
2022-07-14 20:48                                                   ` Stefan Monnier
2022-07-15  5:50                                                   ` Eli Zaretskii
2022-07-15 18:18                                                     ` Alan Mackenzie
2022-07-16  6:03                                                       ` Eli Zaretskii
2022-07-14 17:09                                               ` Eli Zaretskii
2022-07-14 19:33                                                 ` Alan Mackenzie
2022-07-16  6:12                                                   ` Eli Zaretskii
2022-07-16 15:45                                                     ` Alan Mackenzie
2022-07-13 19:13                           ` Redisplay hook error bactraces [Was: Fontification error backtrace] Stefan Monnier
2022-07-13 19:24                             ` Eli Zaretskii
2022-07-13 19:58                             ` Alan Mackenzie
2022-07-13 20:45                               ` Stefan Monnier
2022-06-30 20:34                       ` Fontification error backtrace [Was: Why is it so difficult to get a Lisp backtrace?] Stefan Monnier
2022-07-01  5:39                         ` Eli Zaretskii
2022-07-01 15:34                           ` Juri Linkov
2022-07-01 16:04                             ` Eli Zaretskii
2022-07-01 19:14                               ` Juri Linkov
2022-07-01 19:26                           ` Stefan Monnier
2022-07-02  5:53                             ` Eli Zaretskii
2022-07-02 21:15                               ` Stefan Monnier
2022-07-02 20:27                         ` Alan Mackenzie
2022-07-02 21:12                           ` Stefan Monnier [this message]
2022-06-26  8:45 ` Why is it so difficult to get a Lisp backtrace? Stefan Monnier

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=jwv35fjp6qf.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.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.