Skip to content

How to use GDB to gather debug information on a program

Michael Webster edited this page Mar 2, 2015 · 5 revisions
Install debug symbols:

sudo apt-get install gnome-dbg nemo-dbg cinnamon-dbg muffin-dbg

Kill any existing instances of the program if necessary - for nemo you might simply do:

sudo killall nemo

Start up the debugger.

For a binary program (nemo for instance):

gdb nemo

For a python program:

gdb python

Debugging the program:

For a binary:

run

For a python program:

run *path to .py or python-shebanged file*

****************** Make the program crash **********************
Now get a trace:

thread apply all bt

Be prepared to supply the entire contents of the backtrace - there may (and probably will) be multiple pages, that you'll have to spacebar down to get to the end up - be sure to save all of this.

One you're done you can just type:

quit

Debugging warnings

Run this instead:

G_DEBUG=fatal_warnings gdb nemo

Execution will halt at every glib warning - you can get a backtrace (bt), or keep going (c).

Clone this wiki locally