DebuggingWithValgrind

Differences between revisions 1 and 2
Revision 1 as of 2009-03-28 21:04:34
Size: 1251
Editor: minbar
Comment:
Revision 2 as of 2009-03-28 21:06:45
Size: 1255
Editor: minbar
Comment: braaaaace
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
{{ {{{
Line 17: Line 17:
}} }}}
Line 23: Line 23:
{{ {{{
Line 28: Line 28:
}} }}}

Because /usr/bin/X is normally not started directly by the user, and is also setuid root, running it under valgrind for debugging purposes requires some additonal adjustments. Here's a recipe for running your X server under valgrind that might be helpful.

Note: valgrind is a tool for debugging memory allocation bugs. As a result, running a program under valgrind substantially increases the cost of all memory operations. This will make your X server use more memory and run very slowly. You probably don't want to run X under valgrind unless you are specifically trying to debug a memory corruption error!

Enabling valgrind

If you are starting valgrind from a display manager (such as gdm), the following recipe should be sufficient:

$ sudo dpkg-divert --local --rename --divert /usr/bin/X.valgrind-testing /usr/bin/X
$ sudo tee /usr/bin/X
#!/bin/sh
exec valgrind --error-limit=no --log-file=/var/log/Xorg-valgrind.log X.valgrind-testing "$@"
^D
$ sudo chmod a+x /usr/bin/X
$ sudo chmod u-s /usr/bin/X.valgrind-testing
$

Disabling valgrind

To unwind, run:

$ sudo rm /usr/bin/X
$ sudo chmod u+s /usr/bin/X.valgrind-testing
$ sudo dpkg-divert --remove --local --rename /usr/bin/X
$

X/DebuggingWithValgrind (last edited 2014-05-07 14:04:09 by albertomilone)