njn | e43d3ae | 2003-05-05 13:04:49 +0000 | [diff] [blame] | 1 | |
njn | e43d3ae | 2003-05-05 13:04:49 +0000 | [diff] [blame] | 2 | Building and not installing it |
| 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4 | To run Valgrind without having to install it, run coregrind/valgrind (prefix |
| 5 | with "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 | |
| 10 | This allows you to compile and run with "make" instead of "make install", |
| 11 | saving you time. |
| 12 | |
| 13 | I recommend compiling with "make --quiet" to further reduce the amount of |
| 14 | output spewed out during compilation, letting you actually see any errors, |
| 15 | warnings, etc. |
| 16 | |
| 17 | |
| 18 | Running the regression tests |
| 19 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 20 | To build and run all the regression tests, run "make [--quiet] regtest". |
| 21 | |
| 22 | To run a subset of the regression tests, execute: |
| 23 | |
| 24 | perl tests/vg_regtest <name> |
| 25 | |
| 26 | where <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 |
| 28 | file. 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 | |
nethercote | 16b59ee | 2004-10-09 15:59:05 +0000 | [diff] [blame] | 34 | |
| 35 | Debugging Valgrind with GDB |
| 36 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
nethercote | 4fffabd | 2004-11-02 09:13:12 +0000 | [diff] [blame] | 37 | To debug stage 1 just run it under GDB in the normal way. |
| 38 | |
| 39 | To debug Valgrind proper (stage 2) with GDB, start Valgrind like this: |
nethercote | 16b59ee | 2004-10-09 15:59:05 +0000 | [diff] [blame] | 40 | |
| 41 | valgrind --tool=none --wait-for-gdb=yes <prog> |
| 42 | |
| 43 | Then start gdb like this in another terminal: |
| 44 | |
| 45 | gdb /usr/lib/valgrind/stage2 <pid> |
| 46 | |
| 47 | Where <pid> is the pid valgrind printed. Then set whatever breakpoints |
| 48 | you want and do this in gdb: |
| 49 | |
| 50 | jump *$eip |
| 51 | |
nethercote | 4fffabd | 2004-11-02 09:13:12 +0000 | [diff] [blame] | 52 | Code that runs in the target program such as the pthread replacement |
| 53 | code or the malloc replacement code would have to be debugged as part |
| 54 | of the target program, probably by attaching a debugger after it has |
| 55 | started. We are not sure if this would work, however. |