|
From: <sv...@va...> - 2009-07-21 12:39:49
|
Author: bart
Date: 2009-07-21 13:39:25 +0100 (Tue, 21 Jul 2009)
New Revision: 10503
Log:
Made sure that DRD does something meaningful when using another threading library than LinuxThreads or the NPTL.
Modified:
trunk/drd/drd_mutex.c
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_mutex.c
===================================================================
--- trunk/drd/drd_mutex.c 2009-07-21 11:44:42 UTC (rev 10502)
+++ trunk/drd/drd_mutex.c 2009-07-21 12:39:25 UTC (rev 10503)
@@ -70,7 +70,6 @@
const Addr mutex, const MutexT mutex_type)
{
tl_assert(mutex);
- tl_assert(mutex_type != mutex_type_unknown);
tl_assert(p->a1 == mutex);
p->cleanup = (void(*)(DrdClientobj*))mutex_cleanup;
@@ -146,8 +145,6 @@
return 0;
}
- tl_assert(mutex_type != mutex_type_unknown);
-
p = &(DRD_(clientobj_add)(mutex, ClientMutex)->mutex);
DRD_(mutex_initialize)(p, mutex, mutex_type);
return p;
@@ -165,8 +162,6 @@
{
struct mutex_info* p;
- tl_assert(mutex_type != mutex_type_unknown);
-
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
@@ -349,7 +344,7 @@
struct mutex_info* p;
p = DRD_(mutex_get)(mutex);
- if (mutex_type == mutex_type_unknown)
+ if (p && mutex_type == mutex_type_unknown)
mutex_type = p->mutex_type;
if (s_trace_mutex)
@@ -457,6 +452,8 @@
{
switch (mt)
{
+ case mutex_type_unknown:
+ return "mutex";
case mutex_type_invalid_mutex:
return "invalid mutex";
case mutex_type_recursive_mutex:
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2009-07-21 11:44:42 UTC (rev 10502)
+++ trunk/drd/drd_pthread_intercepts.c 2009-07-21 12:39:25 UTC (rev 10503)
@@ -166,17 +166,18 @@
#if defined(HAVE_PTHREAD_MUTEX_T__M_KIND)
/* glibc + LinuxThreads. */
const int kind = mutex->__m_kind & 3;
+ return DRD_(pthread_to_drd_mutex_type)(kind);
#elif defined(HAVE_PTHREAD_MUTEX_T__DATA__KIND)
/* glibc + NPTL. */
const int kind = mutex->__data.__kind & 3;
+ return DRD_(pthread_to_drd_mutex_type)(kind);
#else
- /* Another POSIX threads implementation. Regression tests will fail. */
- const int kind = PTHREAD_MUTEX_DEFAULT;
- fprintf(stderr,
- "Did not recognize your POSIX threads implementation. Giving up.\n");
- assert(0);
+ /*
+ * Another POSIX threads implementation. The mutex type won't be printed
+ * when enabling --trace-mutex=yes.
+ */
+ return mutex_type_unknown;
#endif
- return DRD_(pthread_to_drd_mutex_type)(kind);
}
/**
|