In TSan we exclude sampling stack variables of the current thread, because it
would dominate the samples and reduce effective data race detection
probability.
The comment above the stack variable check states that if the other thread
samples the access (sets up a watchpoint), we should still detect the data race
(because the watchpoint triggers in the thread that owns the stack variable).
However, the check was still filtering a triggered watchpoint because all
events are filtered with IsInteresting() and we did not distinguish between
sampled accesses and those that triggered a watchpoint.
Fix it by only filtering stack variables if no watchpoint is set up, i.e. we
know the IsInteresting() call is a sampled access.
tsan: Fix stack data-race detection
In TSan we exclude sampling stack variables of the current thread, because it would dominate the samples and reduce effective data race detection probability.
The comment above the stack variable check states that if the other thread samples the access (sets up a watchpoint), we should still detect the data race (because the watchpoint triggers in the thread that owns the stack variable). However, the check was still filtering a triggered watchpoint because all events are filtered with IsInteresting() and we did not distinguish between sampled accesses and those that triggered a watchpoint.
Fix it by only filtering stack variables if no watchpoint is set up, i.e. we know the IsInteresting() call is a sampled access.