OSet* oset;
p = DRD_(barrier_get)(barrier);
- if (p == 0 && barrier_type == gomp_barrier)
- {
+ if (p == 0 && barrier_type == gomp_barrier) {
/*
* gomp_barrier_wait() call has been intercepted but gomp_barrier_init()
* not. The only cause I know of that can trigger this is that libgomp.so
* has been compiled with --enable-linux-futex.
*/
- VG_(message)(Vg_UserMsg, "\n");
- VG_(message)(Vg_UserMsg,
- "Please verify whether gcc has been configured"
- " with option --disable-linux-futex.\n");
- VG_(message)(Vg_UserMsg,
- "See also the section about OpenMP in the DRD manual.\n");
- VG_(message)(Vg_UserMsg, "\n");
+ BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), 0, 0, 0 };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ BarrierErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Please verify whether gcc has been configured"
+ " with option --disable-linux-futex. See also"
+ " the section about OpenMP in the DRD manual.",
+ &bei);
}
tl_assert(p);
VG_(maybe_record_error)(VG_(get_running_tid)(),
DataRaceErr,
VG_(get_IP)(VG_(get_running_tid)()),
- "Conflicting accesses",
+ "Conflicting access",
&drei);
if (s_first_race_only)
#include "drd_error.h"
#include "drd_mutex.h"
#include "pub_tool_vki.h"
-#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
-#include "pub_tool_libcassert.h" // tl_assert()
-#include "pub_tool_libcbase.h" // VG_(strlen)
-#include "pub_tool_libcprint.h" // VG_(message)()
-#include "pub_tool_libcproc.h" // VG_(read_millisecond_timer)()
-#include "pub_tool_machine.h" // VG_(get_IP)()
-#include "pub_tool_threadstate.h" // VG_(get_running_tid)()
+#include "pub_tool_errormgr.h" /* VG_(maybe_record_error)() */
+#include "pub_tool_libcassert.h" /* tl_assert() */
+#include "pub_tool_libcbase.h" /* VG_(strlen) */
+#include "pub_tool_libcprint.h" /* VG_(message)() */
+#include "pub_tool_libcproc.h" /* VG_(read_millisecond_timer)() */
+#include "pub_tool_machine.h" /* VG_(get_IP)() */
+#include "pub_tool_threadstate.h" /* VG_(get_running_tid)() */
/* Local functions. */
if (! p || ! took_lock)
return;
- if (p->recursion_count == 0)
- {
+ if (p->recursion_count == 0) {
if (p->owner != drd_tid && p->owner != DRD_INVALID_THREADID)
{
tl_assert(p->last_locked_segment);
p->acquiry_time_ms = VG_(read_millisecond_timer)();
p->acquired_at = VG_(record_ExeContext)(VG_(get_running_tid)(), 0);
s_mutex_lock_count++;
- }
- else if (p->owner != drd_tid)
- {
- VG_(message)(Vg_UserMsg,
- "The impossible happened: mutex 0x%lx is locked"
- " simultaneously by two threads (recursion count %d,"
- " owners %d and %d) !\n",
- p->a1, p->recursion_count, p->owner, drd_tid);
+ } else if (p->owner != drd_tid) {
+ const ThreadId vg_tid = VG_(get_running_tid)();
+ MutexErrInfo MEI = { DRD_(thread_get_running_tid)(),
+ p->a1, p->recursion_count, p->owner };
+ VG_(maybe_record_error)(vg_tid,
+ MutexErr,
+ VG_(get_IP)(vg_tid),
+ "The impossible happened: mutex is locked"
+ " simultaneously by two threads",
+ &MEI);
p->owner = drd_tid;
}
p->recursion_count++;
}
tl_assert(p);
- if (p->mutex_type != mutex_type)
- {
- VG_(message)(Vg_UserMsg, "??? mutex 0x%lx: type changed from %d into %d\n",
- p->a1, p->mutex_type, mutex_type);
+ if (p->mutex_type != mutex_type) {
+ MutexErrInfo MEI = { DRD_(thread_get_running_tid)(),
+ p->a1, p->recursion_count, p->owner };
+ VG_(maybe_record_error)(vg_tid, MutexErr, VG_(get_IP)(vg_tid),
+ "Mutex type changed", &MEI);
}
tl_assert(p->mutex_type == mutex_type);
tl_assert(p->owner != DRD_INVALID_THREADID);
p = DRD_(rwlock_get_or_allocate)(rwlock, rwlock_type);
tl_assert(p);
- if (DRD_(rwlock_is_wrlocked_by)(p, DRD_(thread_get_running_tid)()))
- {
- VG_(message)(Vg_UserMsg,
- "reader-writer lock 0x%lx is already locked for"
- " writing by calling thread\n",
- p->a1);
+ if (DRD_(rwlock_is_wrlocked_by)(p, DRD_(thread_get_running_tid)())) {
+ RwlockErrInfo REI = { DRD_(thread_get_running_tid)(), p->a1 };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ RwlockErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Already locked for writing by calling thread",
+ &REI);
}
}
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:53)
-The impossible happened: mutex 0x........ is locked simultaneously by two threads (recursion count 1, owners 2 and 1) !
+Thread 1:
+The impossible happened: mutex is locked simultaneously by two threads: mutex 0x........, recursion count 1, owner 2.
+ at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:78)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:53)
+
Thread 2:
Mutex not locked by calling thread: mutex 0x........, recursion count 2, owner 1.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: __assert_rtn (in /...libc...)
by 0x........: main (tc23_bogus_condwait.c:86)
-ERROR SUMMARY: 9 errors from 7 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 10 errors from 8 contexts (suppressed: 0 from 0)
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:53)
-The impossible happened: mutex 0x........ is locked simultaneously by two threads (recursion count 1, owners 2 and 1) !
+Thread 1:
+The impossible happened: mutex is locked simultaneously by two threads: mutex 0x........, recursion count 1, owner 2.
+ at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:78)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:53)
+
Thread 2:
Mutex not locked by calling thread: mutex 0x........, recursion count 2, owner 1.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:53)
-ERROR SUMMARY: 9 errors from 7 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 10 errors from 8 contexts (suppressed: 0 from 0)
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:53)
-The impossible happened: mutex 0x........ is locked simultaneously by two threads (recursion count 1, owners 2 and 1) !
+Thread 1:
+The impossible happened: mutex is locked simultaneously by two threads: mutex 0x........, recursion count 1, owner 2.
+ at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:78)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc23_bogus_condwait.c:53)
+
Thread 2:
Mutex not locked by calling thread: mutex 0x........, recursion count 2, owner 1.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:53)
-ERROR SUMMARY: 11 errors from 9 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 12 errors from 10 contexts (suppressed: 0 from 0)