Thursday, March 23, 2006

Power of valgrind and cgdb combined

I just found out how to make valgrind ask if it should invoke cgdb when it finds an error:

valgrind --db-attach=yes --db-command="cgdb -nw %f %p"

This is incredibly useful. For those of you who don't know, cgdb is a curses interface to gdb, which displays a split view between the code and the gdb console. A bonus is that it uses vim-ish keys and commands. Valgrind is a very powerful memory debugger, which can find memory leaks and find illegal writes and reads to/from memory done by an application.

1 comment: