]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
When started with linuxthreads, the DRD tool now stops as soon as the first thread...
authorBart Van Assche <bvanassche@acm.org>
Sat, 1 Mar 2008 07:25:13 +0000 (07:25 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 1 Mar 2008 07:25:13 +0000 (07:25 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7516

exp-drd/drd_intercepts.c

index 6e14d639234e4e0bd27d991ad0697b36934fc141..fd2ee2b3fa8ae5e9cb05e211d53f8df3da7076d1 100644 (file)
@@ -50,6 +50,7 @@
 #include <pthread.h>
 #include <semaphore.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include "drd_clientreq.h"
 #include "pub_tool_redir.h"
@@ -81,6 +82,7 @@ typedef struct
 // Local variables.
 
 static int vg_main_thread_state_is_set = 0;
+static pid_t vg_main_thread_pid;
 
 
 // Function definitions.
@@ -160,6 +162,17 @@ static void vg_set_joinable(const pthread_t tid, const int joinable)
 static void* vg_thread_wrapper(void* arg)
 {
    int res;
+
+   if (getpid() != vg_main_thread_pid)
+   {
+      fprintf(stderr,
+             "Detected the linuxthreads threading library.\n"
+             "Sorry, but DRD does not support linuxthreads.\n"
+             "Please try to run DRD on a system with NPTL instead.\n"
+             "Giving up.\n");
+      abort();
+   }
+
    VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
                               0, 0, 0, 0, 0);
 
@@ -189,6 +202,8 @@ static void vg_set_main_thread_state(void)
 {
    int res;
 
+   vg_main_thread_pid = getpid();
+
    VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK,
                               0, 0, 0, 0, 0);