GIMP plug-in debugging

Posted on February 14, 2013

I’m working now and then on the metadata browser for GIMP. This now and then can mean a serious gap where I don’t have time to contribute, which means I forget most of the commands for debugging.

The whole debugging story for plug-ins is very well documented in debug-plug-ins.txt. A quick debugging session goes like this:

Start GIMP with an environment variable which is set to the plugin name. After GIMP starts up and calls your plug-in, it stops and waits for the debugger:
GIMP_PLUGIN_DEBUG=metadata,run ~/gimpdev/bin/gimp-2.9 /tmp/hintergrund.jpg
This is a development version of GIMP.  Debug messages may appear here.
jpeg-load: found EXIF block (7686 bytes)
One thing I stumbled over today was the missing PID output (last line). Mitch mitchus figured out the problem. Depending on your version of libglib, you need to provide another environment variable since the logging handler changed:
G_MESSAGES_DEBUG=LibGimp GIMP_PLUGIN_DEBUG=metadata,run ~/gimpdev/bin/gimp-2.9 /tmp/hintergrund.jpg
This is a development version of GIMP.  Debug messages may appear here.
jpeg-load: found EXIF block (7686 bytes)
(metadata:14783): LibGimp-DEBUG: Waiting for debugger...

Now you can use the gdb to attach to the running process (14783) and debug it.