This patch (applied on subversions.gnu.org 2002/07/12) lets you easily debug code line-by-line on x86-linux using Justin Seward's excellent Valgrind memory debugger inside GNU Emacs.
- If you run Emacs 21.2, apply the patch to /usr/share/emacs/21.2/lisp/progmodes/compile.el or an optional location.
- You probably want to byte-compile it (M-x byte-compile-file RET)
- Now M-x compile RET
- Either put
- this after Compile command: in the mini-buffer:
valgrind -v --leak-check=yes --show-reachable=yes myprog - or this inside the source file:
/* * Local variables: * compile-command: "make -k; valgrind -v --leak-check=yes --show-reachable=yes myprog" * End: */
- this after Compile command: in the mini-buffer:
- Finally, step forward and back in source files from the *compilation* buffer (of Valgrind error messages), using
M-n (compilation-next-error) RET and M-p (compilation-previous-error) RET.
Enjoy.