-
Notifications
You must be signed in to change notification settings - Fork 745
How to use GDB to gather debug information on a program
sudo apt-get install gnome-dbg nemo-dbg cinnamon-dbg muffin-dbg
sudo killall nemo
For a binary program (nemo for instance):
gdb nemo
For a python program:
gdb python
For a binary:
run
For a python program:
run *path to .py or python-shebanged file*
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. You can enter set logging on
and then set pagination off
from the gdb prompt to save all of the output to a gdb.txt
file
One you're done you can just type:
quit
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
).
To debug things that actually constitute your environment (the DE), you should ssh in from another PC (or smartphone) - it can be done in tty, but you'll want to throw your computer out the window shortly after.
From another computer/phone:
(ssh into the computer running Cinnamon)
(get the cinnamon process id - use ps -A | grep cinnamon
or something)
sudo gdb
set logging on (this will log everything to gdb.txt on the main pc's home folder - useful later)
attach <cinnamon pid>
c (or continue)
.... follow remaining steps above
to do this using the G_DEBUG flag I find it easier to actually be root than using sudo, to make sure that environment variable is respected:
sudo su (for ubuntu, otherwise just su should be fine)
G_DEBUG=fatal_warnings gdb
......