This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

This page explains how to make debugging symbols available for gdb so that when an application crashes and you get a stack trace it will be much more useful for developers. This usually involves installing debug packages or sometimes recompiling with special flags.

After following your distro's instructions for making the symbols available, see GettingTraces/Details for further information on how to get a new stack trace to submit.

Please see the section of the operating system you are running:

Arch Linux

Please see https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces

Debian

most packages have a -dbgsym or -dbg variant which are in the debian-debug packages. To get them, first add the debug package of your release to /etc/apt/sources.list:

deb http://debug.mirrors.debian.org/debian-debug/ testing-debug main

If needed, replace testing-debug with your release, i.e. stretch-debug

Update apt so it will find the packages:

sudo apt-get update

Now install the debugger (gdb):

sudo apt-get install gdb

Run your application in gdb. In this example we run evince with a file path as argument:

gdb --args /usr/bin/evince /home/user/Documents/report.pdf

Inside the gdb shell type

run

to start the application. It now (in our case) hopefully crashes and you get back to the gdb shell.

To create a backtrace type

thread apply all bt

in the shell so gdb prints the backtrace which has many lines that look like

#2  0x00007f688c21b091 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

The two question marks ?? mean that you don't have the debug symbols for libglib-2.0.so.0 installed.

Quit gdb using q and find out which package the shared object belongs to by typing

dpkg -S /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

You'll get a line which starts like

libglib2.0-0:amd64

Now search for that package using apt-cache:

apt-cache search libglib2.0-0

It'll print a few lines, and if you successfully added debian-debug you'll see the package

libglib2.0-0-dbgsym - debug symbols for libglib2.0-0

Install that package

sudo apt-get install libglib2.0-0-dbgsym

Now start gdb again and look for other missing debug symbols. The backtrace line from above now has more info:

#2  0x00007fbcffc1c091 in g_async_queue_pop_intern_unlocked (
    queue=0x559a132738c0, wait=wait@entry=1, end_time=23288620229)
    at ../../../glib/gasyncqueue.c:422

continue elimination of missing symbols by installing the -dbgsym or -dbg packages for all the other shared objects.

For a more in-depth guide see the Debian wiki: http://wiki.debian.org/HowToGetABacktrace

Fedora

See Fedora wiki: http://fedoraproject.org/wiki/StackTraces

Foresight

Every package has a ":debuginfo" trove. To install these do:

sudo conary update <main-package-name>:debuginfo --sync-to-parents

as a start do:

sudo conary update glib:debuginfo gtk:debuginfo gnome-vfs:debuginfo --sync-to-parents

FreeBSD

To our knowledge, there are no debug packages available. You need to recompile from source. Before doing so, you must include the following line in the /etc/make.conf file:

WITH_DEBUG=

Gentoo

See Gentoo documentation: http://www.gentoo.org/proj/en/qa/backtraces.xml

Mageia

See Mageia wiki: https://wiki.mageia.org/en/Debugging_software_crashes

Mandriva

See Mandriva wiki: http://wiki.mandriva.com/en/Development/Howto/Software_Crash

openSUSE

See openSUSE wiki: http://en.opensuse.org/openSUSE:Bugreport_application_crashed

Ubuntu

See Ubuntu wiki: https://wiki.ubuntu.com/DebuggingProgramCrash


2024-10-23 11:09