DebuggingAndTesting
Running/Debugging
- Compile all test cases: make check
- Run Valgrind from the .in-place directory in a MSys shell
- running hello world 32 bit: VALGRIND_LIB=.in_place coregrind/valgrind.exe memcheck/tests/windows/hello-x86-windows.exe
- running hello world 64 bit: VALGRIND_LIB=.in_place coregrind/valgrind.exe memcheck/tests/windows/hello-amd64-windows.exe
- running a memcheck test: VALGRIND_LIB=.in_place coregrind/valgrind.exe memcheck/tests/badaddrvalue.exe
- start Valgrind with --wait-for-gdb=yes switch to let the tool wait for a debugger to attach (both gdb or WinDbg can attach this way)
- Debugging C code:
- compile code with make OPTIMIZE=-O0
- attach with gdb
- Debugging Assembly code:
- hardcode asm("int $3"); breakpoint(s) where desired
- attach with WinDbg
- control passes to WinDbg as soon as one of the hardcoded breakpoints is hit
- tests/windows is the place for Windows-specific tools, compiling as 32 and 64 bit (or both) versions
- currently there is only one tool: "strace", which can trace system calls and callbacks on the real CPU. Still work in progress:
- no multi-threading
- brute force syscall searching missing in 32 bit modes
Tests
- to build all tests, run make check
- memcheck/tests/windows is the place for Windows-specific memcheck tests, compiling as 32 and 64 bit (or both) versions
- current tests:
- hello - console hello world
- hellowin - GUI hello world
- threadtest - simple test if Valgrind can manage threads
- Other tool tests (note that many but not all tests compile under Windows):
- cachegrind/tests/*.exe (3 tests)
- callgrind/tests/*.exe (2 tests)
- exp-bbv/tests/x86/*.exe (4 tests)
- exp-sgcheck/tests/*.exe (6 tests)
- massif/tests/*.exe (19 tests)
- memcheck/tests/*.exe (90 tests)
- memcheck/tests/amd64/*.exe (6 tests)
- memcheck/tests/x86/*.exe (8 tests)
- none/tests/*.exe (27 tests)
- none/tests/amd64/*.exe (25 tests)
- none/tests/x86/*.exe (19 tests)
- perf/*.exe (8 tests)
Related
Wiki: Home
×
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.