Debugging tips and tricks.
Sébastien Granjoux
seb.sfo@free.fr
Philip Chimento
philip.chimento@gmail.com
Jaume Planas
jplanas@itberga.com 2011
Gil Forcada
gilforcada@guifi.net 2013

# Debugging tips

# Fixing GLib/GTK+ critical errors

Sometimes it can be difficult to track down where GLib critical errors are occurring, since they do not stop the program. You can set the program to stop as soon as it gets a GLib critical error, by setting the environment variable G_DEBUG to the value fatal_criticals.

Open the by selecting RunProgram Parameters... from the main menu.

Click the plus sign next to Environment Variables to expand the list of environment variables.

Click New to add a new entry to the list.

Fill in Name with G_DEBUG and Value with fatal_criticals.

Click Apply to confirm the changes.

Run the program with the debugger by selecting RunDebug Program from the main menu.

Use the program until the critical error occurs.

When the debugger stops your program, look at the to check where this error comes from.

The top function with frame number 0 is in GLib, so you have to look down in the stack. Typically the error originates from the topmost function that belongs to your program.