unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* command and doco for valgrind
@ 2004-01-09 21:42 Nick Roberts
  2004-01-10 12:34 ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Nick Roberts @ 2004-01-09 21:42 UTC (permalink / raw)



Here's a patch for valgrind relating to my earlier message. Any comments?

Nick


--- gud.el	2004-01-09 21:14:21.000000000 +0000
***************
*** 543,548 ****
--- 543,553 ----
    (setq gdb-first-prompt t)
    (run-hooks 'gdb-mode-hook))
  
+ (defun valgrind (command-line)
+   (interactive (list
+    (read-string "Run valgrind (like this): " "valgrind --gdb-attach=yes ")))
+    (gdb command-line))
+ 
  ;; One of the nice features of GDB is its impressive support for
  ;; context-sensitive command completion.  We preserve that feature
  ;; in the GUD buffer by using a GDB command designed just for Emacs.



*** building.texi.~1.34.~	2003-12-18 21:44:37.000000000 +0000
--- building.texi	2004-01-09 21:37:09.000000000 +0000
***************
*** 300,305 ****
--- 300,306 ----
  * GDB Graphical Interface::  An enhanced mode that uses GDB features to
                          implement a graphical debugging environment through
                          Emacs.
+ * Using Valgrind::       Memory management in the GUD buffer.
  @end menu
  
  @node Starting GUD
***************
*** 798,803 ****
--- 799,845 ----
  gdb-frame-@var{buffertype}-buffer} respectively, where @var{buffertype}
  is the relevant buffer type e.g breakpoints.
  
+ @node Using Valgrind
+ @subsection Using Valgrind in the GUD buffer
+ @cindex Valgrind
+ 
+ Valgrind is a tool to help you find memory-management problems in your
+ programs.  You can use it from the command line and this section
+ descibes how to use it with the GUD buffer.
+ 
+ To start running your program through valgrind type:
+ 
+ @example
+ M-x valgrind @key{RET} @var{file} @key{RET}
+ @end example
+ 
+ At a memory violation, when valgrind asks if you want to attach to gdb, type y:
+ 
+ @example
+ ==19752== ---- Attach to GDB ? --- [Return/N/n/Y/y/C/c] ---- y
+ @end example
+ 
+ At the prompt for GDB type:
+ 
+ @example
+ @code{set ann 1} and type @key{RET} if you want the mode for M-x gdb.
+ @code{set ann 3} and type @key{RET} if you want the mode for M-x gdba.
+ @end example
+ 
+ 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 @code{frame 6} in the GUD buffer.  The source code for
+ this call should appear in another buffer in both cases.  Just as with
+ operation from the command line, you can't step through your code when
+ it is run through valgrind.  However you can move up and down the
+ stack and examine the values of variables.  When you want to return
+ control to valgrind type @kbd{C-d} to quit GDB but stay in the GUD
+ buffer.
+ 
  @node Executing Lisp
  @section Executing Lisp Expressions

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

end of thread, other threads:[~2004-03-22 18:27 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-09 21:42 command and doco for valgrind Nick Roberts
2004-01-10 12:34 ` Eli Zaretskii
2004-01-17 23:38   ` Nick Roberts
2004-01-18  7:25     ` Eli Zaretskii
2004-01-18 19:15       ` Richard Stallman
2004-01-19  6:32         ` Eli Zaretskii
2004-01-18 14:17     ` Eli Zaretskii
2004-01-18 19:15       ` Eli Zaretskii
2004-01-19 20:11         ` Richard Stallman
2004-01-19 21:33           ` Eli Zaretskii
2004-01-19 22:57         ` Nick Roberts
2004-01-20  6:21           ` EMACS and valgrind (was: command and doco for valgrind) Eli Zaretskii
2004-01-20 15:26             ` Stefan Monnier
2004-01-22 21:46               ` EMACS and valgrind Nick Roberts
2004-01-22 22:26                 ` Stefan Monnier
2004-01-23 22:07                   ` Nick Roberts
2004-01-24 10:25                     ` Eli Zaretskii
2004-03-21 16:47       ` command and doco for valgrind Nick Roberts
2004-03-21 16:56         ` Eli Zaretskii
2004-03-22 18:27           ` Nick Roberts

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).