blob: f4330a36dabc2e971948b3d9d71392adbebb27ae [file] [log] [blame] [view]
andybonsad92aa32015-08-31 02:27:441# Linux Debugging GTK
2
andybons3322f762015-08-24 21:37:093## Making warnings fatal
4
andybonsad92aa32015-08-31 02:27:445See
6[Running GLib Applications](http://developer.gnome.org/glib/stable/glib-running.html)
7for notes on how to make GTK warnings fatal.
andybons3322f762015-08-24 21:37:098
9## Using GTK Debug packages
10
andybonsad92aa32015-08-31 02:27:4411 sudo apt-get install libgtk2.0-0-dbg
12
13Make sure that you're building a binary that matches your architecture (e.g.
1464-bit on a 64-bit machine), and there you go.
andybons3322f762015-08-24 21:37:0915
16### Source
andybons3322f762015-08-24 21:37:0917
andybonsad92aa32015-08-31 02:27:4418You'll likely want to get the source for gtk too so that you can step through
19it. You can tell gdb that you've downloaded the source to your system's GTK by
20doing:
21
22```shell
andybons3322f762015-08-24 21:37:0923$ cd /my/dir
24$ apt-get source libgtk2.0-0
25$ gdb ...
26(gdb) set substitute-path /build/buildd /my/dir
27```
28
andybonsad92aa32015-08-31 02:27:4429NOTE: I tried debugging pango in a similar manner, but for some reason gdb
30didn't pick up the symbols from the symbols from the `-dbg` package. I ended up
31building from source and setting my `LD_LIBRARY_PATH`.
andybons3322f762015-08-24 21:37:0932
andybonsad92aa32015-08-31 02:27:4433See [linux_building_debug_gtk.md](linux_building_debug_gtk.md) for more on how
34to build your own debug version of GTK.
andybons3322f762015-08-24 21:37:0935
36## Parasite
andybonsad92aa32015-08-31 02:27:4437
38http://chipx86.github.com/gtkparasite/ is great. Go check out the site for more
39about it.
andybons3322f762015-08-24 21:37:0940
41Install it with
andybonsad92aa32015-08-31 02:27:4442
43 sudo apt-get install gtkparasite
andybons3322f762015-08-24 21:37:0944
45And then run Chrome with
andybonsad92aa32015-08-31 02:27:4446
47 GTK_MODULES=gtkparasite ./out/Debug/chrome
andybons3322f762015-08-24 21:37:0948
49### ghardy
andybons3322f762015-08-24 21:37:0950
andybonsad92aa32015-08-31 02:27:4451If you're within the Google network on ghardy, which is too old to include
52gtkparasite, you can do:
andybons3322f762015-08-24 21:37:0953
andybonsad92aa32015-08-31 02:27:4454 scp bunny.sfo:/usr/lib/gtk-2.0/modules/libgtkparasite.so /tmp
55 sudo cp /tmp/libgtkparasite.so /usr/lib/gtk-2.0/modules/libgtkparasite.so
56
nodira6074d4c2015-09-01 04:26:4557## GDK_DEBUG
andybonsad92aa32015-08-31 02:27:4458
59Use `GDK_DEBUG=nograbs` to run GTK+ without grabs. This is useful for gdb
60sessions.