]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Removed support for thread names.
authorBart Van Assche <bvanassche@acm.org>
Sun, 16 Mar 2008 10:42:33 +0000 (10:42 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 16 Mar 2008 10:42:33 +0000 (10:42 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7704

14 files changed:
exp-drd/drd_clientreq.c
exp-drd/drd_clientreq.h
exp-drd/drd_error.c
exp-drd/drd_error.h
exp-drd/drd_main.c
exp-drd/drd_thread.c
exp-drd/drd_thread.h
exp-drd/tests/fp_race.c
exp-drd/tests/fp_race.stderr.exp
exp-drd/tests/pth_cond_race.c
exp-drd/tests/pth_detached.c
exp-drd/tests/pth_detached_sem.c
exp-drd/tests/sem_as_mutex.c
exp-drd/tests/sem_as_mutex.stderr.exp

index e03f7aa07494b66e8bf4d9b7b0fc75efbc010c3d..c2a34857f57630757c5265bfc55a3386fcd52bed 100644 (file)
@@ -93,10 +93,6 @@ static Bool drd_handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret)
     result = vg_tid;
     break;
 
-  case VG_USERREQ__SET_THREAD_NAME:
-    thread_set_name_fmt(drd_tid, (char*)arg[1], arg[2]);
-    break;
-
   case VG_USERREQ__DRD_START_SUPPRESSION:
     drd_start_suppression(arg[1], arg[2], "client");
     break;
index 0c73d91b0caa96d5db137b8c4b9d4142a9d6fcb5..8d421d65145d5ea0cac3cbe52a57746372363060 100644 (file)
@@ -9,9 +9,6 @@ enum {
   /* Ask the core the thread ID assigned by Valgrind. */
   VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D', 'R'),
   /* args: none. */
-  /* Set the name of the thread that performs this client request. */
-  VG_USERREQ__SET_THREAD_NAME,
-  /* args: null-terminated character string. */
 
   /* To tell the drd tool to suppress data race detection on the specified */
   /* address range. */
index e3a7bc9f260324631ea383cca620c8dd30ba5602..50e8ff9f688830780b31014b08b1621d289378b1 100644 (file)
@@ -181,8 +181,8 @@ Char* describe_addr_text(Addr const a, SizeT const len, AddrInfo* const ai,
   {
   case eStack: {
     VG_(snprintf)(buf, n_buf,
-                  "stack of %s, offset %d",
-                  thread_get_name(ai->stack_tid), ai->rwoffset);
+                  "stack of thread %d, offset %d",
+                  ai->stack_tid, ai->rwoffset);
     break;
   }
   case eSegment: {
@@ -235,9 +235,9 @@ void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri)
     describe_addr(dri->addr, dri->size, &ai);
   }
   VG_(message)(Vg_UserMsg,
-               "Conflicting %s by %s at 0x%08lx size %ld",
+               "Conflicting %s by thread %d at 0x%08lx size %ld",
                dri->access_type == eStore ? "store" : "load",
-               thread_get_name(VgThreadIdToDrdThreadId(dri->tid)),
+               DrdThreadIdToVgThreadId(dri->tid),
                dri->addr,
                dri->size);
   VG_(pp_ExeContext)(VG_(get_error_where)(err));
@@ -258,7 +258,7 @@ void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri)
   {
     VG_(message)(Vg_UserMsg, "Allocation context: unknown.");
   }
-  thread_report_conflicting_segments(VgThreadIdToDrdThreadId(dri->tid),
+  thread_report_conflicting_segments(dri->tid,
                                      dri->addr, dri->size, dri->access_type);
 }
 
index ab95c8f4870eeaf23ec8cf657746cbdc67e23a2b..5da18b5cc38d77e669ffe8e575e7669b859cbb89 100644 (file)
@@ -78,7 +78,7 @@ struct {                      // Used by:
    AddrInfo;
 
 typedef struct {
-   ThreadId      tid;         // Thread ID of the running thread.
+   DrdThreadId   tid;         // Thread ID of the running thread.
    Addr          addr;        // Conflicting address in current thread.
    SizeT         size;        // Size in bytes of conflicting operation.
    BmAccessTypeT access_type; // Access type: load or store.
index fc9fc5c812c018380adb8f20d37933f0fa3ff490..db33579222719a01d80f38561fc1bedfafdc94be 100644 (file)
@@ -154,7 +154,7 @@ static void drd_trace_mem_access(const Addr addr, const SizeT size,
   char vc[80];
   vc_snprint(vc, sizeof(vc), thread_get_vc(thread_get_running_tid()));
   VG_(message)(Vg_UserMsg,
-               "%s 0x%lx size %ld %s (vg %d / drd %d / vc %s)",
+               "%s 0x%lx size %ld (vg %d / drd %d / vc %s)",
                access_type == eLoad
                ? "load "
                : access_type == eStore
@@ -166,7 +166,6 @@ static void drd_trace_mem_access(const Addr addr, const SizeT size,
                : "????",
                addr,
                size,
-               thread_get_name(thread_get_running_tid()),
                VG_(get_running_tid)(),
                thread_get_running_tid(),
                vc);
@@ -184,7 +183,7 @@ static void drd_report_race(const Addr addr, const SizeT size,
   if (drd_is_suppressed(addr, addr + size))
     return;
 
-  drei.tid  = VG_(get_running_tid)();
+  drei.tid  = thread_get_running_tid();
   drei.addr = addr;
   drei.size = size;
   drei.access_type = access_type;
index fafac5f80c307b0d6c7e4ae15c7d1c8fa3108f08..dc598183521856b7fec8e16c91241cdfcaf30c01 100644 (file)
@@ -122,9 +122,6 @@ DrdThreadId VgThreadIdToNewDrdThreadId(const ThreadId tid)
       s_threadinfo[i].stack_min     = 0;
       s_threadinfo[i].stack_startup = 0;
       s_threadinfo[i].stack_max     = 0;
-      VG_(snprintf)(s_threadinfo[i].name, sizeof(s_threadinfo[i].name),
-                    "thread %d", tid);
-      s_threadinfo[i].name[sizeof(s_threadinfo[i].name) - 1] = 0;
       s_threadinfo[i].is_recording  = True;
       s_threadinfo[i].synchr_nesting = 0;
       if (s_threadinfo[i].first != 0)
@@ -350,32 +347,6 @@ void thread_set_joinable(const DrdThreadId tid, const Bool joinable)
   s_threadinfo[tid].detached_posix_thread = ! joinable;
 }
 
-const char* thread_get_name(const DrdThreadId tid)
-{
-  tl_assert(0 <= tid && tid < DRD_N_THREADS
-            && tid != DRD_INVALID_THREADID);
-  return s_threadinfo[tid].name;
-}
-
-void thread_set_name(const DrdThreadId tid, const char* const name)
-{
-  tl_assert(0 <= tid && tid < DRD_N_THREADS
-            && tid != DRD_INVALID_THREADID);
-  VG_(strncpy)(s_threadinfo[tid].name, name,
-               sizeof(s_threadinfo[tid].name));
-  s_threadinfo[tid].name[sizeof(s_threadinfo[tid].name) - 1] = 0;
-}
-
-void thread_set_name_fmt(const DrdThreadId tid, const char* const fmt,
-                         const UWord arg)
-{
-  tl_assert(0 <= tid && tid < DRD_N_THREADS
-            && tid != DRD_INVALID_THREADID);
-  VG_(snprintf)(s_threadinfo[tid].name, sizeof(s_threadinfo[tid].name),
-                fmt, arg);
-  s_threadinfo[tid].name[sizeof(s_threadinfo[tid].name) - 1] = 0;
-}
-
 void thread_set_vg_running_tid(const ThreadId vg_tid)
 {
   tl_assert(vg_tid != VG_INVALID_THREADID);
@@ -688,15 +659,14 @@ void thread_print_all(void)
     if (s_threadinfo[i].first)
     {
       VG_(printf)("**************\n"
-                  "* thread %3d (%d/%d/%d/0x%x/%d/%s) *\n"
+                  "* thread %3d (%d/%d/%d/0x%x/%d) *\n"
                   "**************\n",
                   i,
                   s_threadinfo[i].vg_thread_exists,
                   s_threadinfo[i].vg_threadid,
                   s_threadinfo[i].posix_thread_exists,
                   s_threadinfo[i].pt_threadid,
-                  s_threadinfo[i].detached_posix_thread,
-                  s_threadinfo[i].name);
+                  s_threadinfo[i].detached_posix_thread);
       for (p = s_threadinfo[i].first; p; p = p->next)
       {
         sg_print(p);
@@ -711,10 +681,7 @@ static void show_call_stack(const DrdThreadId tid,
 {
   const ThreadId vg_tid = DrdThreadIdToVgThreadId(tid);
 
-  VG_(message)(Vg_UserMsg,
-               "%s (%s)",
-               msg,
-               thread_get_name(tid));
+  VG_(message)(Vg_UserMsg, "%s (thread %d)", msg, tid);
 
   if (vg_tid != VG_INVALID_THREADID)
   {
index f92b551b90161f365a7d5d1b0fb2fddedcf954c4..24e3506c0eae133d885895c42951c02dcc1dbb58 100644 (file)
@@ -63,7 +63,6 @@ typedef struct
   Addr      stack_min;
   Addr      stack_startup;
   Addr      stack_max;
-  char      name[32];
   /// Indicates whether the Valgrind core knows about this thread.
   Bool      vg_thread_exists;
   /// Indicates whether there is an associated POSIX thread ID.
@@ -109,10 +108,6 @@ DrdThreadId thread_lookup_stackaddr(const Addr a,
 void thread_set_pthreadid(const DrdThreadId tid, const PThreadId ptid);
 Bool thread_get_joinable(const DrdThreadId tid);
 void thread_set_joinable(const DrdThreadId tid, const Bool joinable);
-const char* thread_get_name(const DrdThreadId tid);
-void thread_set_name(const DrdThreadId tid, const char* const name);
-void thread_set_name_fmt(const DrdThreadId tid, const char* const name,
-                         const UWord arg);
 void thread_set_vg_running_tid(const ThreadId vg_tid);
 void thread_set_running_tid(const ThreadId vg_tid,
                             const DrdThreadId drd_tid);
index facf6e4baf97cf8edbc2c4eeb5d74120216cca35..d23d7580b8d262e92c3b2a1679ef5b894664355c 100644 (file)
@@ -52,20 +52,11 @@ static int    s_use_mutex = 0;
 
 // Function definitions.
 
-static void set_thread_name(const char* const name)
-{
-  int res;
-  VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_THREAD_NAME,
-                             name, 0, 0, 0, 0);
-}
-
 int main(int argc, char** argv)
 {
   int optchar;
   pthread_t threadid;
 
-  set_thread_name("main");
-
   while ((optchar = getopt(argc, argv, "dmp")) != EOF)
   {
     switch (optchar)
@@ -123,8 +114,6 @@ int main(int argc, char** argv)
 
 static void* thread_func(void* thread_arg)
 {
-  set_thread_name("thread_func");
-
   if (s_do_printf)
   {
     printf("s_d1 = %g (should be 1)\n", s_d1);
index 09e51318754d22d318338af3924ac79f379f32e1..bceb943444bc4717746fa24867c9519f4b588577 100644 (file)
@@ -1,20 +1,20 @@
 
-Conflicting load by main at 0x........ size 8
+Conflicting load by thread 1 at 0x........ size 8
    at 0x........: main (fp_race.c:?)
 Location 0x........ is 0 bytes inside local var "s_d3"
 declared at fp_race.c:47, in frame #? of thread 1
-Other segment start (thread_func)
+Other segment start (thread 2)
    (thread finished, call stack no longer available)
-Other segment end (thread_func)
+Other segment end (thread 2)
    (thread finished, call stack no longer available)
 
-Conflicting store by main at 0x........ size 8
+Conflicting store by thread 1 at 0x........ size 8
    at 0x........: main (fp_race.c:?)
 Location 0x........ is 0 bytes inside local var "s_d3"
 declared at fp_race.c:47, in frame #? of thread 1
-Other segment start (thread_func)
+Other segment start (thread 2)
    (thread finished, call stack no longer available)
-Other segment end (thread_func)
+Other segment end (thread 2)
    (thread finished, call stack no longer available)
 
 ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
index 367d585c48fe8f0797736d062bb04a9b8428dec8..ad77bacf62838ca42fd666b68dfbf3687886c809 100644 (file)
@@ -23,20 +23,11 @@ static int             s_use_mutex = 0;
 
 // Function definitions.
 
-static void set_thread_name(const char* const name)
-{
-  int res;
-  VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_THREAD_NAME,
-                             "%s", name, 0, 0, 0);
-}
-
 int main(int argc, char** argv)
 {
   int optchar;
   pthread_t threadid;
 
-  set_thread_name("main");
-
   while ((optchar = getopt(argc, argv, "m")) != EOF)
   {
     switch (optchar)
@@ -68,8 +59,6 @@ int main(int argc, char** argv)
 
 static void* thread_func(void* thread_arg)
 {
-  set_thread_name("thread_func");
-
   // Wait until the main thread has entered pthread_cond_wait().
   pthread_mutex_lock(&s_mutex);
   pthread_mutex_unlock(&s_mutex);
index 0d4eea56416d997dcdc4f4f45072fbb544aa3b17..8e64f91427b54009a7f34de33d6da20d5f9ce7b3 100644 (file)
 
 
 static int s_finished_count;
-static int s_set_thread_name;
 static pthread_mutex_t s_mutex;
 
 
-static void set_thread_name(const char* const fmt, const int arg)
-{
-  if (s_set_thread_name)
-  {
-    int res;
-    char name[32];
-    snprintf(name, sizeof(name), fmt, arg);
-    name[sizeof(name) - 1] = 0;
-    VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_THREAD_NAME,
-                               name, 0, 0, 0, 0);
-  }
-}
-
 static void increment_finished_count()
 {
   pthread_mutex_lock(&s_mutex);
@@ -47,7 +33,6 @@ static int get_finished_count()
 
 static void* thread_func1(void* arg)
 {
-  set_thread_name("thread_func1[%d]", *(int*)arg);
   write(STDOUT_FILENO, ".", 1);
   increment_finished_count();
   return 0;
@@ -55,7 +40,6 @@ static void* thread_func1(void* arg)
 
 static void* thread_func2(void* arg)
 {
-  set_thread_name("thread_func2[%d]", *(int*)arg);
   pthread_detach(pthread_self());
   write(STDOUT_FILENO, ".", 1);
   increment_finished_count();
@@ -66,16 +50,11 @@ int main(int argc, char** argv)
 {
   const int count1 = argc > 1 ? atoi(argv[1]) : 100;
   const int count2 = argc > 2 ? atoi(argv[2]) : 100;
-  const int do_set_thread_name = argc > 3 ? atoi(argv[3]) != 0 : 0;
   int thread_arg[count1 > count2 ? count1 : count2];
   int i;
   int detachstate;
   pthread_attr_t attr;
 
-  s_set_thread_name = do_set_thread_name;
-
-  set_thread_name("main", 0);
-
   for (i = 0; i < count1 || i < count2; i++)
     thread_arg[i] = i;
 
index af8df170c934d23f41652a70de8b181d3b78565f..91b0bb0cf7d6e1de21ef7833ee57d01ffcacfc5a 100644 (file)
 #include "../drd_clientreq.h"
 
 
-static int   s_set_thread_name;
 static sem_t s_sem;
 
 
-static void set_thread_name(const char* const fmt, const int arg)
-{
-  if (s_set_thread_name)
-  {
-    int res;
-    char name[32];
-    snprintf(name, sizeof(name), fmt, arg);
-    name[sizeof(name) - 1] = 0;
-    VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_THREAD_NAME,
-                               name, 0, 0, 0, 0);
-  }
-}
-
 static void increment_finished_count()
 {
   sem_post(&s_sem);
@@ -40,7 +26,6 @@ static void increment_finished_count()
 
 static void* thread_func1(void* arg)
 {
-  set_thread_name("thread_func1[%d]", *(int*)arg);
   write(STDOUT_FILENO, ".", 1);
   increment_finished_count();
   return 0;
@@ -48,7 +33,6 @@ static void* thread_func1(void* arg)
 
 static void* thread_func2(void* arg)
 {
-  set_thread_name("thread_func2[%d]", *(int*)arg);
   pthread_detach(pthread_self());
   write(STDOUT_FILENO, ".", 1);
   increment_finished_count();
@@ -59,16 +43,11 @@ int main(int argc, char** argv)
 {
   const int count1 = argc > 1 ? atoi(argv[1]) : 100;
   const int count2 = argc > 2 ? atoi(argv[2]) : 100;
-  const int do_set_thread_name = argc > 3 ? atoi(argv[3]) != 0 : 0;
   int thread_arg[count1 > count2 ? count1 : count2];
   int i;
   int detachstate;
   pthread_attr_t attr;
 
-  s_set_thread_name = do_set_thread_name;
-
-  set_thread_name("main", 0);
-
   for (i = 0; i < count1 || i < count2; i++)
     thread_arg[i] = i;
 
index b0842f5fff8d238a56e6dd65e01de4c54e75626a..7a1c358ee3f6f54f22f6a7f3f3cee8d6c0cc7a6a 100644 (file)
@@ -53,20 +53,11 @@ static int    s_do_mutual_exclusion = 0;
 
 // Function definitions.
 
-static void set_thread_name(const char* const name)
-{
-  int res;
-  VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_THREAD_NAME,
-                             name, 0, 0, 0, 0);
-}
-
 int main(int argc, char** argv)
 {
   int optchar;
   pthread_t threadid;
 
-  set_thread_name("main");
-
   while ((optchar = getopt(argc, argv, "dmp")) != EOF)
   {
     switch (optchar)
@@ -124,8 +115,6 @@ int main(int argc, char** argv)
 
 static void* thread_func(void* thread_arg)
 {
-  set_thread_name("thread_func");
-
   if (s_do_printf)
   {
     printf("s_d1 = %g (should be 1)\n", s_d1);
index e6b9616845e412400c80b51d62ff196a2e3c85ab..ccd4d003dd740e0b4fe31429a5664275e9876275 100644 (file)
@@ -1,20 +1,20 @@
 
-Conflicting load by main at 0x........ size 8
+Conflicting load by thread 1 at 0x........ size 8
    at 0x........: main (sem_as_mutex.c:?)
 Location 0x........ is 0 bytes inside local var "s_d3"
 declared at sem_as_mutex.c:48, in frame #? of thread 1
-Other segment start (thread_func)
+Other segment start (thread 2)
    (thread finished, call stack no longer available)
-Other segment end (thread_func)
+Other segment end (thread 2)
    (thread finished, call stack no longer available)
 
-Conflicting store by main at 0x........ size 8
+Conflicting store by thread 1 at 0x........ size 8
    at 0x........: main (sem_as_mutex.c:?)
 Location 0x........ is 0 bytes inside local var "s_d3"
 declared at sem_as_mutex.c:48, in frame #? of thread 1
-Other segment start (thread_func)
+Other segment start (thread 2)
    (thread finished, call stack no longer available)
-Other segment end (thread_func)
+Other segment end (thread 2)
    (thread finished, call stack no longer available)
 
 ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)