1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
*********
Debugging
*********
X11 server
==========
If you are developing on a linux system, it is recommended that you
reconfigure your X11 server with the following setup (see the file
:file:`/etc/X11/XF86Config-4`)::
Section "ServerFlags"
Option "AllowDeactivateGrabs" "true" # Ctrl+Alt+Keypad *
Option "AllowClosedownGrabs" "true" # Ctrl+Alt+Keypad /
EndSection
The two key bindings described above are used to release any grab that
a GUI application might have. This is especially useful when debugging
through `gdb`: it might happen that the breakpoint happens while
such a grab is in place, and would therefore prevent any input (mouse
or keyboard) to any application in your X11 session, in particular the
debugger.
gtk+ library
============
It is also recommended that you recompile your own gtk+ library (on
systems where this is easily doable such as Unix systems), with the
following configure command::
./configure --with-debug=yes
In addition to providing the usual debugging information in the
debugger, this also activates several environment variables which
might be used to monitor the actions in gtk+ and its associated
libraries.
These variables are the following::
export GTK_DEBUG=misc:plugsocket:text:tree:updates:keybindings;
export GDK_DEBUG=updates:nograbs:events:dnd:misc:xim:colormap:gdkrb:gc:pixmap:image:input:cursor;
export GOBJECT_DEBUG=objects:signals;
Some of the values for these variables can be omitted. The exact
semantic (or even the exact list) of such variables depends on your
version of gtk+, and you should therefore consult its documentation.
debugger
========
When debugging with `gdb`, it is recommended that you always
specify the flag `--sync` to gps. This forces any gtk+
application, and in particular GPS, to process X11 events
synchronously, and therefore makes it easier to debug possible
problems.
If your application is printing some gtk+ warnings on the console, you
should do the following in the debugger::
(gdb) set args --sync
(gdb) begin
(gdb) break g_log
(gdb) cont
This will stop the application as soon as the gtk+ warning is printed.
|