From: Bart Van Assche Date: Sun, 16 Mar 2008 17:57:01 +0000 (+0000) Subject: All error and trace messages now show both Valgrind's and DRD's thread ID. X-Git-Tag: svn/VALGRIND_3_4_0~852 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8a980611eb50d10d2cbedd55fb98b0ce8189a674;p=thirdparty%2Fvalgrind.git All error and trace messages now show both Valgrind's and DRD's thread ID. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7716 --- diff --git a/exp-drd/drd_error.c b/exp-drd/drd_error.c index 21a8e2f86c..ef72522746 100644 --- a/exp-drd/drd_error.c +++ b/exp-drd/drd_error.c @@ -81,10 +81,10 @@ void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri) describe_malloced_addr(dri->addr, dri->size, &ai); } VG_(message)(Vg_UserMsg, - "Conflicting %s by thread %d at 0x%08lx size %ld", + "Conflicting %s by thread %d/%d at 0x%08lx size %ld", dri->access_type == eStore ? "store" : "load", DrdThreadIdToVgThreadId(dri->tid), - /*dri->tid,*/ + dri->tid, dri->addr, dri->size); VG_(pp_ExeContext)(VG_(get_error_where)(err)); @@ -156,8 +156,9 @@ static void drd_tool_error_pp(Error* const e) case CondDestrErr: { CondDestrErrInfo* cdi = (CondDestrErrInfo*)(VG_(get_error_extra)(e)); VG_(message)(Vg_UserMsg, - "%s: cond 0x%lx, mutex 0x%lx locked by thread %d", - cdi->cond, cdi->mutex, cdi->tid); + "%s: cond 0x%lx, mutex 0x%lx locked by thread %d/%d", + cdi->cond, cdi->mutex, + DrdThreadIdToVgThreadId(cdi->tid), cdi->tid); VG_(pp_ExeContext)(VG_(get_error_where)(e)); break; } diff --git a/exp-drd/drd_segment.c b/exp-drd/drd_segment.c index d8f1943a2e..6cf4f8df77 100644 --- a/exp-drd/drd_segment.c +++ b/exp-drd/drd_segment.c @@ -81,8 +81,8 @@ void sg_init(Segment* const sg, { char msg[256]; VG_(snprintf)(msg, sizeof(msg), - "New segment for thread %d with vc ", - creator); + "New segment for thread %d/%d with vc ", + DrdThreadIdToVgThreadId(creator), creator); vc_snprint(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg), &sg->vc); VG_(message)(Vg_UserMsg, "%s", msg); diff --git a/exp-drd/drd_thread.c b/exp-drd/drd_thread.c index 45eb2351db..17cf5a761c 100644 --- a/exp-drd/drd_thread.c +++ b/exp-drd/drd_thread.c @@ -225,14 +225,6 @@ DrdThreadId thread_post_create(const ThreadId vg_created) /* ignored. */ void thread_set_stack_startup(const DrdThreadId tid, const Addr stack_startup) { -#if 0 - VG_(message)(Vg_DebugMsg, "thread_set_stack_startup: thread %d (%d)" - " stack 0x%x .. 0x%lx (size %d)", - s_threadinfo[tid].vg_threadid, tid, - stack_startup, - s_threadinfo[tid].stack_max, - s_threadinfo[tid].stack_max - stack_startup); -#endif tl_assert(0 <= tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); tl_assert(s_threadinfo[tid].stack_min <= stack_startup); tl_assert(stack_startup <= s_threadinfo[tid].stack_max); @@ -358,8 +350,9 @@ void thread_set_running_tid(const ThreadId vg_tid, const DrdThreadId drd_tid) && s_drd_running_tid != DRD_INVALID_THREADID) { VG_(message)(Vg_DebugMsg, - "Context switch from thread %d to thread %d", - s_drd_running_tid, drd_tid); + "Context switch from thread %d/%d to thread %d/%d", + s_vg_running_tid, s_drd_running_tid, + DrdThreadIdToVgThreadId(drd_tid), drd_tid); } s_vg_running_tid = vg_tid; s_drd_running_tid = drd_tid; @@ -668,7 +661,7 @@ static void show_call_stack(const DrdThreadId tid, { const ThreadId vg_tid = DrdThreadIdToVgThreadId(tid); - VG_(message)(Vg_UserMsg, "%s (thread %d)", msg, /*vg_tid,*/ tid); + VG_(message)(Vg_UserMsg, "%s (thread %d/%d)", msg, vg_tid, tid); if (vg_tid != VG_INVALID_THREADID) { @@ -775,8 +768,8 @@ static void thread_update_danger_set(const DrdThreadId tid) char msg[256]; VG_(snprintf)(msg, sizeof(msg), - "computing danger set for thread %d with vc ", - tid); + "computing danger set for thread %d/%d with vc ", + DrdThreadIdToVgThreadId(tid), tid); vc_snprint(msg + VG_(strlen)(msg), sizeof(msg) - VG_(strlen)(msg), &s_threadinfo[tid].last->vc); diff --git a/exp-drd/tests/fp_race.stderr.exp b/exp-drd/tests/fp_race.stderr.exp index bceb943444..8c509c70a7 100644 --- a/exp-drd/tests/fp_race.stderr.exp +++ b/exp-drd/tests/fp_race.stderr.exp @@ -1,20 +1,20 @@ -Conflicting load by thread 1 at 0x........ size 8 +Conflicting load by thread 1/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 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) -Conflicting store by thread 1 at 0x........ size 8 +Conflicting store by thread 1/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 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/hg03_inherit.stderr.exp b/exp-drd/tests/hg03_inherit.stderr.exp index 681579ead2..5533a7c4f1 100644 --- a/exp-drd/tests/hg03_inherit.stderr.exp +++ b/exp-drd/tests/hg03_inherit.stderr.exp @@ -1,31 +1,31 @@ Thread 3: -Conflicting store by thread 3 at 0x........ size 4 +Conflicting store by thread 3/3 at 0x........ size 4 at 0x........: t2 (hg03_inherit.c:28) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside shared[1], declared at hg03_inherit.c:11, in frame #? of thread 3 -Other segment start (thread 1) +Other segment start (thread 1/1) at 0x........: pthread_join (drd_pthread_intercepts.c:?) by 0x........: main (hg03_inherit.c:49) -Other segment end (thread 1) +Other segment end (thread 1/1) at 0x........: (within libpthread-?.?.so) by 0x........: pthread_join (drd_pthread_intercepts.c:?) by 0x........: main (hg03_inherit.c:63) -Conflicting store by thread 3 at 0x........ size 4 +Conflicting store by thread 3/3 at 0x........ size 4 at 0x........: t2 (hg03_inherit.c:29) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside shared[1], declared at hg03_inherit.c:11, in frame #? of thread 3 -Other segment start (thread 1) +Other segment start (thread 1/1) at 0x........: pthread_join (drd_pthread_intercepts.c:?) by 0x........: main (hg03_inherit.c:49) -Other segment end (thread 1) +Other segment end (thread 1/1) at 0x........: (within libpthread-?.?.so) by 0x........: pthread_join (drd_pthread_intercepts.c:?) by 0x........: main (hg03_inherit.c:63) diff --git a/exp-drd/tests/hg04_race.stderr.exp b/exp-drd/tests/hg04_race.stderr.exp index dd7b91f11d..e9ad4351a8 100644 --- a/exp-drd/tests/hg04_race.stderr.exp +++ b/exp-drd/tests/hg04_race.stderr.exp @@ -1,27 +1,27 @@ Thread 2: -Conflicting load by thread 2 at 0x........ size 4 +Conflicting load by thread 2/3 at 0x........ size 4 at 0x........: th (hg04_race.c:10) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside local var "shared" declared at hg04_race.c:6, in frame #? of thread 2 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) -Conflicting store by thread 2 at 0x........ size 4 +Conflicting store by thread 2/3 at 0x........ size 4 at 0x........: th (hg04_race.c:10) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside local var "shared" declared at hg04_race.c:6, in frame #? of thread 2 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/hg05_race2.stderr.exp b/exp-drd/tests/hg05_race2.stderr.exp index 02910761f8..876b30205e 100644 --- a/exp-drd/tests/hg05_race2.stderr.exp +++ b/exp-drd/tests/hg05_race2.stderr.exp @@ -1,27 +1,27 @@ Thread 2: -Conflicting load by thread 2 at 0x........ size 4 +Conflicting load by thread 2/3 at 0x........ size 4 at 0x........: th (hg05_race2.c:17) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside foo.poot[5].plop[11], declared at hg05_race2.c:24, in frame #? of thread 1 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) -Conflicting store by thread 2 at 0x........ size 4 +Conflicting store by thread 2/3 at 0x........ size 4 at 0x........: th (hg05_race2.c:17) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside foo.poot[5].plop[11], declared at hg05_race2.c:24, in frame #? of thread 1 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/rwlock_race.stderr.exp b/exp-drd/tests/rwlock_race.stderr.exp index 7e73726e73..560d313b71 100644 --- a/exp-drd/tests/rwlock_race.stderr.exp +++ b/exp-drd/tests/rwlock_race.stderr.exp @@ -1,27 +1,27 @@ Thread 2: -Conflicting load by thread 2 at 0x........ size 4 +Conflicting load by thread 2/3 at 0x........ size 4 at 0x........: thread (rwlock_race.c:?) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside local var "s_racy" declared at rwlock_race.c:17, in frame #? of thread 2 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) -Conflicting store by thread 2 at 0x........ size 4 +Conflicting store by thread 2/3 at 0x........ size 4 at 0x........: thread (rwlock_race.c:?) by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?) by 0x........: (within libpthread-?.?.so) by 0x........: clone (in /...libc...) Location 0x........ is 0 bytes inside local var "s_racy" declared at rwlock_race.c:17, in frame #? of thread 2 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) Result: 2 diff --git a/exp-drd/tests/sem_as_mutex.stderr.exp b/exp-drd/tests/sem_as_mutex.stderr.exp index ccd4d003dd..b02899a281 100644 --- a/exp-drd/tests/sem_as_mutex.stderr.exp +++ b/exp-drd/tests/sem_as_mutex.stderr.exp @@ -1,20 +1,20 @@ -Conflicting load by thread 1 at 0x........ size 8 +Conflicting load by thread 1/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 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) -Conflicting store by thread 1 at 0x........ size 8 +Conflicting store by thread 1/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 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/tc01_simple_race.stderr.exp b/exp-drd/tests/tc01_simple_race.stderr.exp index abe4f211e3..28db43ac5a 100644 --- a/exp-drd/tests/tc01_simple_race.stderr.exp +++ b/exp-drd/tests/tc01_simple_race.stderr.exp @@ -1,20 +1,20 @@ -Conflicting load by thread 1 at 0x........ size 4 +Conflicting load by thread 1/1 at 0x........ size 4 at 0x........: main (tc01_simple_race.c:28) Location 0x........ is 0 bytes inside global var "x" declared at tc01_simple_race.c:9 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) -Conflicting store by thread 1 at 0x........ size 4 +Conflicting store by thread 1/1 at 0x........ size 4 at 0x........: main (tc01_simple_race.c:28) Location 0x........ is 0 bytes inside global var "x" declared at tc01_simple_race.c:9 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/tc16_byterace.stderr.exp b/exp-drd/tests/tc16_byterace.stderr.exp index 35bfc961af..4454700d58 100644 --- a/exp-drd/tests/tc16_byterace.stderr.exp +++ b/exp-drd/tests/tc16_byterace.stderr.exp @@ -1,20 +1,20 @@ -Conflicting load by thread 1 at 0x........ size 1 +Conflicting load by thread 1/1 at 0x........ size 1 at 0x........: main (tc16_byterace.c:34) Location 0x........ is 0 bytes inside bytes[4], a global variable declared at tc16_byterace.c:7 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) -Conflicting store by thread 1 at 0x........ size 1 +Conflicting store by thread 1/1 at 0x........ size 1 at 0x........: main (tc16_byterace.c:34) Location 0x........ is 0 bytes inside bytes[4], a global variable declared at tc16_byterace.c:7 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/tc20_verifywrap.stderr.exp b/exp-drd/tests/tc20_verifywrap.stderr.exp index 1efc93fe23..6a60bc01d8 100644 --- a/exp-drd/tests/tc20_verifywrap.stderr.exp +++ b/exp-drd/tests/tc20_verifywrap.stderr.exp @@ -5,13 +5,13 @@ ---------------- pthread_create/join ---------------- -Conflicting store by thread 1 at 0x........ size 2 +Conflicting store by thread 1/1 at 0x........ size 2 at 0x........: main (tc20_verifywrap.c:78) Location 0x........ is 0 bytes inside global var "unprotected" declared at tc20_verifywrap.c:27 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ---------------- pthread_mutex_lock et al ---------------- diff --git a/exp-drd/tests/tc20_verifywrap2.stderr.exp b/exp-drd/tests/tc20_verifywrap2.stderr.exp index b02f57cf51..7345f23b78 100644 --- a/exp-drd/tests/tc20_verifywrap2.stderr.exp +++ b/exp-drd/tests/tc20_verifywrap2.stderr.exp @@ -5,13 +5,13 @@ ---------------- pthread_create/join ---------------- -Conflicting store by thread 1 at 0x........ size 2 +Conflicting store by thread 1/1 at 0x........ size 2 at 0x........: main (tc20_verifywrap.c:78) Location 0x........ is 0 bytes inside global var "unprotected" declared at tc20_verifywrap.c:27 -Other segment start (thread 2) +Other segment start (thread 0/2) (thread finished, call stack no longer available) -Other segment end (thread 2) +Other segment end (thread 0/2) (thread finished, call stack no longer available) ---------------- pthread_mutex_lock et al ----------------