Added support for OpenMP barriers -- if libgomp.so has been built with debug information. More in general, added support for nested synchronization constructs.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7642 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-drd/drd_mutex.c b/exp-drd/drd_mutex.c
index 55598ae..df79cbe 100644
--- a/exp-drd/drd_mutex.c
+++ b/exp-drd/drd_mutex.c
@@ -57,15 +57,11 @@
static
void mutex_initialize(struct mutex_info* const p,
- const Addr mutex,
- const SizeT size,
- const MutexT mutex_type)
+ const Addr mutex, const MutexT mutex_type)
{
tl_assert(mutex != 0);
- tl_assert(size > 0);
tl_assert(p->a1 == mutex);
- tl_assert(p->a2 == mutex + size);
p->cleanup = (void(*)(DrdClientobj*))&mutex_cleanup;
p->mutex_type = mutex_type;
p->recursion_count = 0;
@@ -101,9 +97,7 @@
static
struct mutex_info*
-mutex_get_or_allocate(const Addr mutex,
- const SizeT size,
- const MutexT mutex_type)
+mutex_get_or_allocate(const Addr mutex, const MutexT mutex_type)
{
struct mutex_info* p;
@@ -111,12 +105,10 @@
p = &clientobj_get(mutex, ClientMutex)->mutex;
if (p)
{
- tl_assert(p->mutex_type == mutex_type);
- tl_assert(p->a2 - p->a1 == size);
return p;
}
- if (clientobj_present(mutex, mutex + size))
+ if (clientobj_present(mutex, mutex + 1))
{
GenericErrInfo GEI;
VG_(maybe_record_error)(VG_(get_running_tid)(),
@@ -127,8 +119,8 @@
return 0;
}
- p = &clientobj_add(mutex, mutex + size, ClientMutex)->mutex;
- mutex_initialize(p, mutex, size, mutex_type);
+ p = &clientobj_add(mutex, ClientMutex)->mutex;
+ mutex_initialize(p, mutex, mutex_type);
return p;
}
@@ -140,7 +132,7 @@
/** Called before pthread_mutex_init(). */
struct mutex_info*
-mutex_init(const Addr mutex, const SizeT size, const MutexT mutex_type)
+mutex_init(const Addr mutex, const MutexT mutex_type)
{
struct mutex_info* p;
@@ -178,7 +170,7 @@
&MEI);
return p;
}
- p = mutex_get_or_allocate(mutex, size, mutex_type);
+ p = mutex_get_or_allocate(mutex, mutex_type);
return p;
}
@@ -208,11 +200,13 @@
* an attempt is made to lock recursively a synchronization object that must
* not be locked recursively.
*/
-void mutex_pre_lock(const Addr mutex, const SizeT size, MutexT mutex_type)
+void mutex_pre_lock(const Addr mutex, MutexT mutex_type)
{
struct mutex_info* p;
- p = mutex_get(mutex);
+ p = mutex_get_or_allocate(mutex, mutex_type);
+
+ tl_assert(p);
if (s_trace_mutex)
{
@@ -220,10 +214,10 @@
"[%d/%d] pre_mutex_lock %s 0x%lx rc %d owner %d",
VG_(get_running_tid)(),
thread_get_running_tid(),
- p ? mutex_get_typename(p) : "(?)",
+ mutex_get_typename(p),
mutex,
- p ? p->recursion_count : 0,
- p ? p->owner : VG_INVALID_THREADID);
+ p->recursion_count,
+ p->owner);
}
if (mutex_type == mutex_type_invalid_mutex)
@@ -237,13 +231,6 @@
return;
}
- if (p == 0)
- {
- p = mutex_init(mutex, size, mutex_type);
- }
-
- tl_assert(p);
-
if (p->owner == thread_get_running_tid()
&& p->recursion_count >= 1
&& mutex_type != mutex_type_recursive_mutex)