|
From: Nicholas N. <nj...@cs...> - 2006-02-22 21:55:41
|
On Wed, 22 Feb 2006, Joe Mason wrote: >>> Is there a way to (ab)use valgrind 3.1 to track all write-access >>> to a specific address? >> >> At least on x86 and amd64 you don't need VG for that. >> Gdb hardware watchpoints get you there much faster. > > However, if you can't use gcc, add this to your source: > > #include <valgrind/memcheck.h> > > ... > // make valgrind report all reads and writes to an address > VALGRIND_MAKE_NOACCESS(addr, numbytes); > // make valgrind stop reporting reads to the address > VALGRIND_MAKE_READABLE(addr, numbytes); > > (By default if you allocate some memory, valgrind marks it both READABLE > and WRITABLE, so I *think* you have to turn those off with NOACCESS. > But I can't recall - MAKE_READABLE might automatically turn off WRITABLE > The MAKE_NOACCESS line may not be necessary - MAKE_READABLE might > automatically turn off WRITABLE as well.) MAKE_NOACCESS is the right thing to use. Our use of the term "readable" is a bit confusing, because it really means "readable and writable". Nick |