Variants and Patches
Several other Valgrind tools have been created. Some of these
can plug directly into an existing Valgrind installation, but
some require downloading a whole Valgrind distribution which
contains a specially modified core. Please note that some of
these are experimental, and may not work 100%.
Back
Robert Walsh's Patches
http://www.durables.org/~rjwalsh/
The complete set is rolled together as
valgrind-patches.tar.bz2.
These patches are against the CVS head as of Tue Feb
1 15:29:24 PST 2005
. They may or may not apply to later
CVS versions.
If you're looking for patches against older releases, see
the 2.1.0 patch page and
the 2.0.0 patch page on my website.
- 02-watchpoints (diff)
-
This patch adds two new client requests: id =
VALGRIND_SET_WATCHPOINT(address, length)
, which allows the
application to set a watchpoint on a memory location, and
VALGRIND_CLEAR_WATCHPOINT(id)
, which allows the
application to clear a previous watchpoint.
You can also set watchpoints on the command line using
--watchpoint=WP,...
. WP
is of the form
X
, X-Y
or X+Y
for a single
address, an address range or an address and length, respectively.
X
and Y
can be decimal or hexadecimal
numbers. Hexadecimal numbers are prefixed with 0x
.
You can specify the --watchpoint
option as many
times as you want.
Watchpoints are triggered when memory within the address range
is read or written to, when memory is allocated or freed on top
of the address range or when the address range goes into or out
of scope on the stack.
When a watchpoint is triggered, the stack backtrace from the
triggering location is printed out, along with a count of the
number of times the watchpoint has been triggered.
memcheck/docs/mc_main.html | 42 +++
memcheck/mc_main.c | 395 ++++++++++++++++++++++++++++++++++-
memcheck/memcheck.h | 24 ++
memcheck/tests/Makefile.am | 8
memcheck/tests/wp_cmdline.c | 19 +
memcheck/tests/wp_cmdline.stderr.exp | 15 +
memcheck/tests/wp_cmdline.vgtest | 2
memcheck/tests/wp_simple.c | 17 +
memcheck/tests/wp_simple.stderr.exp | 14 +
memcheck/tests/wp_simple.vgtest | 1
memcheck/tests/wp_stack.c | 26 ++
memcheck/tests/wp_stack.stderr.exp | 30 ++
memcheck/tests/wp_stack.vgtest | 1
13 files changed, 587 insertions(+), 7 deletions(-)
- 10-mempool (diff)
-
This patch extends the leak detection code to detect leaks in
memory pools.
coregrind/vg_malloc2.c | 5 -
include/tool.h.base | 3
memcheck/mac_leakcheck.c | 177 ++++++++++++++++++++++++--------------
memcheck/mac_needs.c | 19 +++-
memcheck/mc_main.c | 18 +++
memcheck/tests/mempool.c | 2
memcheck/tests/mempool.stderr.exp | 38 +++++++-
memcheck/tests/mempool.vgtest | 2
8 files changed, 186 insertions(+), 78 deletions(-)