|
From: Nick R. <ni...@ni...> - 2004-01-10 16:11:57
|
I posted the message below to ema...@gn.... However, I have not used
valgrind in earnest. Could anyone who is familiar with both valgrind and emacs
please comment on its usefulness (or lack of it!). Please note, however, that
THIS REQUIRES THE CVS VERSION OF EMACS from the repository at Savannah.
Thanks,
Nick http://www.nick.uklinux.net
> Type M-x gdb in the minibuffer and when prompted with (something like):
> Run gdb (like this): gdb --annotate=3
> replace it with (if your executable is ~/myprog, say):
> Run gdb (like this): valgrind --gdb-attach=yes ~/myprog
> At a memory violation, when valgrind asks if you want to atach to gdb, type y:
> ==19752== ---- Attach to GDB ? --- [Return/N/n/Y/y/C/c] ---- y
> At the prompt for GDB type:
> `set ann 3' and press <RET> if you want the mode for gdb in gdb-ui.el
> `set ann 1' and press <RET> if you want the mode for gdb in gud.el
> In the first case, the main routine appears in the source buffer and the
> resulting layout depends on the value of gdb-many-windows. In the second case,
> nothing happens immediately.
> If you now type bt, GDB prints the call stack. This also includes calls to
> valgrind's code. Identify the frame number of your code, 6 say, and type:
> (gdb) frame 6
> and the code for this call should appear in the source buffer in both
> cases. Just as with the command line you can't step through your code under
> valgrind but you can move up and down the stack and examine the values of
> variables. When you want to return to valgrind type Ctrl-D to quit GDB but
> stay in the GUD buffer.
|