emacs-devel
[Top][All Lists]
Advanced

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

Re: How to get crash dump and consequently debug?


From: Daniel Brooks
Subject: Re: How to get crash dump and consequently debug?
Date: Tue, 01 Dec 2020 21:40:24 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Pankaj Jangid <pankaj@codeisgreat.org> writes:

> Yesterday, my emacs crashed when I was doing M-$ i.e. ispell-word. But I
> could not reproduce it using any sequence of steps.
>
> My question is: how to approach in this case? More specifically, how to get a
> core-dump and subsequently debug emacs using it. Is there a small
> tutorial of some kind on this topic?

You don't say, so I'll just assume that you're using Linux. Most Linux
distributions don't keep core dumps by default, so probably don't have a
core file to debug with. If you had thought to enable core dumps, then
you can use it with GDB by specifying the file name on the command line:

    gdb [options] [executable-file [core-file or process-id]]

If your Linux distribution uses systemd, then you can also debug core
dumps using coredumpctl; it just launches GDB for you:

    coredumpctl debug [MATCHES…]

If you don't have a core dump, then you do need to find a way to
reproduce the bug. Normally you would have to find accurate steps to
reproduce so that you could reproduce the problem reliably while running
Emacs inside the debugger, but there is another way.

You could install rr (rr-project.org), an open-source program for
recording the execution of other programs. If you use it to record all
of your Emacs sessions, then you can use it to debug those crashes
without needing to know how to reproduce the problem. Any recordings
that don't capture a crash can be discarded.

Where a core file contains the state of the program at the moment of a
crash, an rr recording contains the entire state of the program, from
start to finish. You can replay the complete execution of the program
from start to finish, or run it backwards to reach an earlier point in
time. This enables you to track problems backwards from the site of the
crash to real origin of the problem. This is particularly useful in
cases of data corruption, or when one action sets up some code that runs
later for a fall.

db48x



reply via email to

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