On Mon, Feb 25, 2008 at 1:42 PM, Julian Seward <[EMAIL PROTECTED]> wrote:
>
> > Only _start. Even if I would track _stop, I still would need code in
> > the drd_trace_load() / drd_trace_store() functions for verifying
> > whether VG_(get_running_tid)() changed.
>
> You really need to intercept the _stop function.
>
> * when notified with _start, cache the thread ID provided.
>
> * when notified with _stop, discard the cached thread ID.
>
> * when you need to know the thread ID, first see if you have
> a cached ID. If not, call VG_(get_running_tid) (but don't
> cache the result).
The code that is currently executed by exp-drd at the start of every
memory load and store is about as follows:
if (VG_(get_running_tid) != cached_tid)
{ cached_tid = VG_(get_running_tid); /* update danger set */; }
When tracking both _start and _stop, the code at the start of every
memory load and store will look as follows:
if (tracked_thread_id == VG_INVALID_THREADID && VG_(get_running_tid)
!= cached_tid)
{ cached_tid = VG_(get_running_tid); /* update danger set */; }
Is this an improvement ? This would save one function call in the
common path, but there is also an alternative solution for this --
declaring VG_(get_running_tid)() inline. And the code for checking the
thread ID still has to be executed for every client memory load and
for every client memory store.
I still prefer that the Valgrind core calls a tracking function to
notify a tool about any thread ID changes.
Bart.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers