]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Update README_DEVELOPERS to describe how to debug valgrind more
authorTom Hughes <tom@compton.nu>
Thu, 17 Nov 2005 12:31:12 +0000 (12:31 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 17 Nov 2005 12:31:12 +0000 (12:31 +0000)
easily. Based on patch from Yao Qi <qiyaoltc@cn.ibm.com>.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5165

README_DEVELOPERS

index defce7859aeb6b6a3a065a00d236c76b9aa64cdd..a3e835e7f5d2a2d6a596d1bc0f333553ff44a224 100644 (file)
@@ -35,20 +35,35 @@ file.  Eg:
 
 Debugging Valgrind with GDB
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-To debug stage 1 just run it under GDB in the normal way.
+To debug the valgrind launcher program (<prefix>/bin/valgrind) just
+run it under gdb in the normal way.
 
-To debug Valgrind proper (stage 2) with GDB, start Valgrind like this:
+Debugging the main body of the valgrind code (and/or the code for
+a particular tool) requires a bit more trickery but can be achieved
+without too much problem by following these steps:
 
-  valgrind --tool=none --wait-for-gdb=yes <prog>
+(1) Set VALGRIND_LAUNCHER to <prefix>/bin/valgrind:
 
-Then start gdb like this in another terminal:
+    export VALGRIND_LAUNCHER=/usr/local/bin/valgrind
 
-  gdb /usr/lib/valgrind/stage2 <pid>
+(2) Run "gdb <prefix>/lib/valgrind/<platform>/<tool>":
 
-Where <pid> is the pid valgrind printed. Then set whatever breakpoints
-you want and do this in gdb:
+    gdb /usr/local/lib/valgrind/ppc32-linux/lackey
 
-  jump *$eip
+(3) Do "handle SIGSEGV SIGILL nostop noprint" in GDB to prevent GDB from
+    stopping on a SIGSEGV or SIGILL:
+
+    (gdb) handle SIGILL SIGSEGV nostop noprint
+
+(4) Set any breakpoints you want and proceed as normal for gdb. The
+    macro VG_(FUNC) is expanded to vgPlain_FUNC, so If you want to set
+    a breakpoint VG_(do_exec), you could do like this in GDB:
+
+    (gdb) b vgPlain_do_exec
+
+(5) Run the tool with required options:
+
+    (gdb) run pwd
 
 
 Self-hosting