Debugging tips and tricks.
Sébastien Granjoux
seb.sfo@free.fr
Philip Chimento
philip.chimento@gmail.com
Daniel Nylander
po@danielnylander.se 2007
Anders Jonsson
anders.jonsson@norsjovallen.se 2017

# Felsökningstips

# Fixa kritiska GLib/GTK+-fel

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 Run Program 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 Run Debug 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.