Daily Shaarli

All links of one day in a single page.

March 31, 2014

billiob's blog - gdb + valgrind

valgrind can run a gdb server so that a gdb can interact with it. valgrind has 2 options to trigger that:

--vgdb=yes,
--vgdb-error=0.

This second option tells valgrind it needs to wait for that many errors before freezing and wait for a gdb to connect. Setting it to 0 will make valgrind to wait for gdb to connect before executing the program.

valgrind --vgdb=yes --vgdb-error=0 ./foo
gdb ./foo
(gdb) target remote | vgdb