Made sure that DRD does something meaningful when using another threading library than LinuxThreads or the NPTL.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10503 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_mutex.c b/drd/drd_mutex.c
index 514744c..65cf046 100644
--- a/drd/drd_mutex.c
+++ b/drd/drd_mutex.c
@@ -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:
diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
index db33fbd..8c98934 100644
--- a/drd/drd_pthread_intercepts.c
+++ b/drd/drd_pthread_intercepts.c
@@ -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;
-#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);
-#endif
    return DRD_(pthread_to_drd_mutex_type)(kind);
+#else
+   /*
+    * Another POSIX threads implementation. The mutex type won't be printed
+    * when enabling --trace-mutex=yes.
+    */
+   return mutex_type_unknown;
+#endif
 }
 
 /**