Reputation: 131385
I know valgrind can notice invalid accesses to memory even when the OS doesn't, by some sort of magic instrumentation.
My question: Can I tell it, at runtime and assuming my program is being run by valgrind, to start monitoring (write) accesses to a certain region of memory (which I specify at run time)? So that valgrind will blurt something out when this access happens, along with a stack trace?
Upvotes: 0
Views: 51
Reputation: 7724
Search VALGRIND_MAKE_MEM_NOACCESS - this is the way you tell valgrind the memory should not be accessed.
Note it will fail both write and read access to this region. I'm not sure you can disable write and allow read, if that's what you want.
Upvotes: 1