-
Notifications
You must be signed in to change notification settings - Fork 52
Generating a backtrace
When dealing with an issue about Twinkle crashing or hanging, the best piece of information you can provide us with is a backtrace.
(Your distribution may have additional information on this subject. For example, the Ubuntu Wiki has an article dedicated to backtraces.)
A useful backtrace requires that debug symbols for Twinkle be available.
- If you have compiled Twinkle yourself, add
-DCMAKE_BUILD_TYPE=Debug
to the list of CMake options and recompile. - If you are using a package provided by your distribution, install the
corresponding debug symbols package. For Debian and its derivatives (such as
Ubuntu), this would be
twinkle-dbgsym
; see the Debian Wiki or the Ubuntu Wiki for more information.
Install the GNU Debugger, also known as
GDB (typically packaged as gdb
).
Running Twinkle in a GDB interactive session is the most common method of generating a backtrace, and is best suited if you can easily trigger the bug.
- Run
gdb twinkle
- Type
set logging on
- Type
set pagination off
- Type
handle SIG32 noprint
- Type
run
- Trigger the bug that makes Twinkle hang or crash
- If Twinkle is hung, make it crash by pressing CTRL and
\
- Type
thread apply all backtrace
- Type
quit
(answery
if you are asked to confirm)
You can then provide us with a copy of the gdb.txt
file that was created.
(Note that the full
option is not recommended by default, as it could result
in passwords or other sensitive information to be included in the backtrace.)
If the previous method is inconvenient for you (typically, if Twinkle crashes infrequently and you don't want to go through all the steps above every time you launch it), you can instead opt to have Twinkle dump its core in the event of a crash.
For this to work, you first have to enable core dumps with ulimit -c unlimited
, performed in the shell that Twinkle will be started from. (You
could write a small wrapper shell script to automate this before every launch.)
Twinkle can now be launched as usual. If it crashes, it will generate a
core
dump file in the directory it was launched from. (If it hangs, you can
make it crash with kill -9 <PID>
.)
At this point:
- Run
gdb twinkle <core-dump-file-location>
- Type
set logging on
- Type
thread apply all backtrace
- Press
c
andEnter
- Type
quit
(answery
if you are asked to confirm)