The GNU Project Debugger (gdb) is a general purpose debugger, but we're mostly going to focus on getting useful information when an application crashes. To get started, open an application in gdb, for example AppCenter by running:
Now run this application by typing run
and pressing enter.
If the application doesn't crash right away try reproducing the crash.
Get more information by typing backtrace
and pressing enter.
Please share the lines after (gdb) backtrace
, those should provide useful information.
For more information see the manpages by running: man gdb
. Another tutorial: Debugging with GDB
Running the application under gdb slows down the application and is problematic to reproduce some crashes. In such cases, it is recommended to use the systemd-coredump service which will gather application information on crash.
Let's take our example above of AppCenter: if the application would have crashed without understanding what might have happened, the service would retain the backtrace which is then replayable with:
If there are lines such as 0x00001234deadbeef in ?? ()
it means that we are missing some debugging symbols.
The debugging symbols of elementary OS are hidden by default (as they are taking some space). To be able to discover then, we need to add their corresponding debian source:
We can then install all the missing debugging symbols with:
Rerunning coredumpctl debug
should now show more useful traces.
For a flatpak application, we can use flatpak-coredumpctl io.elementary.elementary.calculator
to see the latest traces of a crash inside flatpak.