unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Using Valgrind in the GUD buffer (two modes)
@ 2003-12-28 14:51 Nick Roberts
  2003-12-29 11:54 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Roberts @ 2003-12-28 14:51 UTC (permalink / raw)



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.

I would like to add a section about this in the Emacs manual. Are there any
objections?



    Nick                                         http://www.nick.uklinux.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Valgrind in the GUD buffer (two modes)
  2003-12-28 14:51 Using Valgrind in the GUD buffer (two modes) Nick Roberts
@ 2003-12-29 11:54 ` Richard Stallman
  2003-12-29 12:29   ` Per Abrahamsen
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2003-12-29 11:54 UTC (permalink / raw)
  Cc: emacs-devel

    replace it with (if your executable is ~/myprog, say):

    Run gdb (like this): valgrind --gdb-attach=yes ~/myprog

    ...

    I would like to add a section about this in the Emacs manual. Are there any
    objections?

What is the license of valgrind?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Valgrind in the GUD buffer (two modes)
  2003-12-29 11:54 ` Richard Stallman
@ 2003-12-29 12:29   ` Per Abrahamsen
  2003-12-30 19:43     ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Per Abrahamsen @ 2003-12-29 12:29 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

> What is the license of valgrind?

  Valgrind is Copyright (C) 2000-2003 Julian Seward
  and licensed under the GNU General Public License, version 2.
  Bug reports, feedback, admiration, abuse, etc, to: jseward@acm.org.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Valgrind in the GUD buffer (two modes)
  2003-12-29 12:29   ` Per Abrahamsen
@ 2003-12-30 19:43     ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2003-12-30 19:43 UTC (permalink / raw)
  Cc: emacs-devel

    > What is the license of valgrind?

      Valgrind is Copyright (C) 2000-2003 Julian Seward
      and licensed under the GNU General Public License, version 2.
      Bug reports, feedback, admiration, abuse, etc, to: jseward@acm.org.

Thanks.  This means it is ok to add something to the Emacs manual
about how to use valgrind with M-x gdb.  If someone writes it,
we can install it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-30 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-28 14:51 Using Valgrind in the GUD buffer (two modes) Nick Roberts
2003-12-29 11:54 ` Richard Stallman
2003-12-29 12:29   ` Per Abrahamsen
2003-12-30 19:43     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).