Valgrind 2.4.0 patches

These patches are against the Valgrind 2.4 SVN head as of the last update date. They may or may not apply to later SVN versions of the 2.4 tree.

Last update: Tue, 13 May 2008 21:44:03 -0700

mempool.diff
This patch extends the leak detection code to detect leaks in memory pools.

This patch no longer applies to the SVN head. I've kept it here for reference only. An update may appear at some point in the near future.

 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 ++++-
 valgrind-mempool/memcheck/tests/mempool.vgtest |    2 
 8 files changed, 186 insertions(+), 78 deletions(-)
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                   |  392 ++++++++++++++++++++++++++++++++++-
 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, 583 insertions(+), 8 deletions(-)

Robert Walsh <rjwalsh@durables.org>