blob: 34fb10b0ca860c4d6d4a83e1bd5fed7a6302a109 [file] [log] [blame]
njne43d3ae2003-05-05 13:04:49 +00001
njne43d3ae2003-05-05 13:04:49 +00002Building and not installing it
3~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4To run Valgrind without having to install it, run coregrind/valgrind (prefix
5with "sh" because it's not executable) with the --in-place=<dir> option, where
6<dir> is the root of the source tree (and must be an absolute path). Eg:
7
8 sh ~/grind/head4/coregrind/valgrind --in-place=/homes/njn25/grind/head4
9
10This allows you to compile and run with "make" instead of "make install",
11saving you time.
12
13I recommend compiling with "make --quiet" to further reduce the amount of
14output spewed out during compilation, letting you actually see any errors,
15warnings, etc.
16
17
18Running the regression tests
19~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20To build and run all the regression tests, run "make [--quiet] regtest".
21
22To run a subset of the regression tests, execute:
23
24 perl tests/vg_regtest <name>
25
26where <name> is a directory (all tests within will be run) or a single
27.vgtest test file, or the name of a program which has a like-named .vgtest
28file. Eg:
29
30 perl tests/vg_regtest memcheck
31 perl tests/vg_regtest memcheck/tests/badfree.vgtest
32 perl tests/vg_regtest memcheck/tests/badfree
33
nethercote16b59ee2004-10-09 15:59:05 +000034
35Debugging Valgrind with GDB
36~~~~~~~~~~~~~~~~~~~~~~~~~~~
nethercote4fffabd2004-11-02 09:13:12 +000037To debug stage 1 just run it under GDB in the normal way.
38
39To debug Valgrind proper (stage 2) with GDB, start Valgrind like this:
nethercote16b59ee2004-10-09 15:59:05 +000040
41 valgrind --tool=none --wait-for-gdb=yes <prog>
42
43Then start gdb like this in another terminal:
44
45 gdb /usr/lib/valgrind/stage2 <pid>
46
47Where <pid> is the pid valgrind printed. Then set whatever breakpoints
48you want and do this in gdb:
49
50 jump *$eip
51
nethercote4fffabd2004-11-02 09:13:12 +000052Code that runs in the target program such as the pthread replacement
53code or the malloc replacement code would have to be debugged as part
54of the target program, probably by attaching a debugger after it has
55started. We are not sure if this would work, however.