|
From: Nicholas N. <nj...@cs...> - 2005-08-17 15:04:26
|
On Wed, 17 Aug 2005, Rob Holland wrote: > Sorry if it wasn't clear from my previous email. I have it sorted now :) Good. > Just figuring out how to report errors from the replacement functions > now, looks like they can't resolve the VG_ symbols. You've dived right into a fairly tricky part of Valgrind :) Replacement functions run on the *simulated* CPU, unlike most of Valgrind's code. You can't call any of Valgrind's functions directly from there. If you want access to Valgrind-world, you'll need to use a client request (VALGRIND_NON_SIMD_CALL[1234]) as the "trap-door" access mechanism. See coregrind/m_replacemalloc/vg_replace_malloc.c for examples of this (excuse the heavy pre-processor use in that file). These trap-doors are how functions such as ms_malloc() in massif/ms_main.c. If you do use these client requests, note that the function you call gets the current ThreadId automatically inserted as the first argument! You can see this with ms_malloc() in massif/ms_main.c. Nick |