unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: gdb doesn't print Lisp backtrace in some circumstances.
Date: Fri, 12 Apr 2024 15:03:03 +0300	[thread overview]
Message-ID: <86mspyss94.fsf@gnu.org> (raw)
In-Reply-To: <ZhkbGdebUY4DOQzA@ACM> (message from Alan Mackenzie on Fri, 12 Apr 2024 11:29:29 +0000)

> Date: Fri, 12 Apr 2024 11:29:29 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> > But you can reproduce the Lisp backtrace manually (albeit tediously,
> > by going over all the calls to Ffuncall, eval_sub and suchlikes, and
> > displaying their arg[0].  If it's a symbol, typing xsymbol should show
> > you the Lisp function being called.  If it is not a symbol, you could
> > use xcar/xcdr etc., but that is much more tedious, and I usually give
> > up on those frames in the stack.
> 
> I spent a large part of yesterday on this dump.  It ends up with a call
> (apply apply ...) which goes into an infinite recursion with the number
> of arguments increasing by 1 at each stage.  I've found the point in the
> backtrace where the recursion starts, but it's tedious indeed getting
> information out of it.  I think I'll have to, though, since I can't see
> any other way of debugging this at the moment.

One way of avoiding all this tedious manual work is to try to catch
the problem with a breakpoint in a running Emacs, not in a core dump.
You need to be creative and most probably invest a lot of efforts in
trial-and-error to come up with a breakpoint place and condition that
on one hand doesn't cause it to trigger too often for false positives,
and OTOH doesn't miss the real problem.

An easier way is to run Emacs under GDB to begin with, and do what you
need to do when it catches the segfault, before dumping core.  At that
point, you still have a running Emacs, and can call functions inside
it, albeit less safely (because when Emacs is crashing, its Lisp
machine could be utterly confused or messed up).



  reply	other threads:[~2024-04-12 12:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 10:31 gdb doesn't print Lisp backtrace in some circumstances Alan Mackenzie
2024-04-12 11:11 ` Eli Zaretskii
2024-04-12 11:29   ` Alan Mackenzie
2024-04-12 12:03     ` Eli Zaretskii [this message]
2024-04-12 13:18       ` Alan Mackenzie
2024-04-12 13:24         ` Eli Zaretskii
2024-04-13 10:07           ` Alan Mackenzie
2024-04-12 14:48   ` Gerd Möllmann
2024-04-12 14:56     ` Gerd Möllmann
2024-04-12 15:08       ` Eli Zaretskii

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=86mspyss94.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).