18 Jul 2002 ole   » (Journeyer)

Valgrind and GNU Emacs lovers

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.

  1. If you run Emacs 21.2, apply the patch to /usr/share/emacs/21.2/lisp/progmodes/compile.el or an optional location.
  2. You probably want to byte-compile it (M-x byte-compile-file RET)
  3. Now M-x compile RET
  4. 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:
       */
      
  5. 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.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!