From: Philippe Waroquiers Date: Tue, 29 Jul 2014 20:08:15 +0000 (+0000) Subject: Helgrind lock related error msg improvements. X-Git-Tag: svn/VALGRIND_3_10_0~237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd6256c0199a955c3a55e02d47407fc5eab07087;p=thirdparty%2Fvalgrind.git Helgrind lock related error msg improvements. * Add lock announcements in various helgrind errors that were not announcing the locks * ensure locks are also announced in xml (note that this is compatible with xml protocol version 4, so no impact on GUI which properly implement the protocol) Changes done: * Like other HG record_error functions, HG_(record_error_LockOrder) is now passing Lock* rather than lock guest addresses. * update exp files for tests that were showing locks without announcing them * change tc14_laog_dinphils.c and tc15_laog_lockdel.c so as to have same sizes on 32 and 64 bits systems for allocated or symbol sizes. * factorise all code that was announcing first lock observation * enable xml lock announcement git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14204 --- diff --git a/helgrind/hg_errors.c b/helgrind/hg_errors.c index 537d98bd73..321b2b7f37 100644 --- a/helgrind/hg_errors.c +++ b/helgrind/hg_errors.c @@ -331,8 +331,8 @@ typedef Thread* thr; /* The first 4 fields describe the previously observed (should-be) ordering. */ - Addr shouldbe_earlier_ga; - Addr shouldbe_later_ga; + Lock* shouldbe_earlier_lk; + Lock* shouldbe_later_lk; ExeContext* shouldbe_earlier_ec; ExeContext* shouldbe_later_ec; /* In principle we need to record two more stacks, from @@ -566,8 +566,8 @@ void HG_(record_error_UnlockBogus) ( Thread* thr, Addr lock_ga ) void HG_(record_error_LockOrder)( Thread* thr, - Addr shouldbe_earlier_ga, - Addr shouldbe_later_ga, + Lock* shouldbe_earlier_lk, + Lock* shouldbe_later_lk, ExeContext* shouldbe_earlier_ec, ExeContext* shouldbe_later_ec, ExeContext* actual_earlier_ec @@ -579,9 +579,13 @@ void HG_(record_error_LockOrder)( init_XError(&xe); xe.tag = XE_LockOrder; xe.XE.LockOrder.thr = thr; - xe.XE.LockOrder.shouldbe_earlier_ga = shouldbe_earlier_ga; + xe.XE.LockOrder.shouldbe_earlier_lk + = mk_LockP_from_LockN(shouldbe_earlier_lk, + False/*!allowed_to_be_invalid*/); xe.XE.LockOrder.shouldbe_earlier_ec = shouldbe_earlier_ec; - xe.XE.LockOrder.shouldbe_later_ga = shouldbe_later_ga; + xe.XE.LockOrder.shouldbe_later_lk + = mk_LockP_from_LockN(shouldbe_later_lk, + False/*!allowed_to_be_invalid*/); xe.XE.LockOrder.shouldbe_later_ec = shouldbe_later_ec; xe.XE.LockOrder.actual_earlier_ec = actual_earlier_ec; // FIXME: tid vs thr @@ -766,14 +770,19 @@ static void announce_LockP ( Lock* lk ) tl_assert(lk->magic == LockP_MAGIC); if (VG_(clo_xml)) { - /* fixme: add announcement */ + if (lk->appeared_at) { + emit( " Lock at %p was first observed\n", + (void*)lk ); + VG_(pp_ExeContext)( lk->appeared_at ); + } + } else { if (lk->appeared_at) { - VG_(umsg)( "Lock at %p was first observed\n", + VG_(umsg)( " Lock at %p was first observed\n", (void*)lk->guestaddr ); VG_(pp_ExeContext)( lk->appeared_at ); } else { - VG_(umsg)( "Lock at %p : no stacktrace for first observation\n", + VG_(umsg)( " Lock at %p : no stacktrace for first observation\n", (void*)lk->guestaddr ); } HG_(get_and_pp_addrdescr) (lk->guestaddr); @@ -948,8 +957,8 @@ void HG_(pp_Error) ( Error* err ) emit( " Thread #%d: lock order \"%p before %p\" " "violated\n", (Int)xe->XE.LockOrder.thr->errmsg_index, - (void*)xe->XE.LockOrder.shouldbe_earlier_ga, - (void*)xe->XE.LockOrder.shouldbe_later_ga ); + (void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr, + (void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr ); emit( " %d\n", (Int)xe->XE.LockOrder.thr->errmsg_index ); emit( " \n" ); @@ -958,24 +967,26 @@ void HG_(pp_Error) ( Error* err ) && xe->XE.LockOrder.shouldbe_later_ec) { emit( " Required order was established by " "acquisition of lock at %p\n", - (void*)xe->XE.LockOrder.shouldbe_earlier_ga ); + (void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr ); VG_(pp_ExeContext)( xe->XE.LockOrder.shouldbe_earlier_ec ); emit( " followed by a later acquisition " "of lock at %p\n", - (void*)xe->XE.LockOrder.shouldbe_later_ga ); + (void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr ); VG_(pp_ExeContext)( xe->XE.LockOrder.shouldbe_later_ec ); } + announce_LockP ( xe->XE.LockOrder.shouldbe_earlier_lk ); + announce_LockP ( xe->XE.LockOrder.shouldbe_later_lk ); } else { emit( "Thread #%d: lock order \"%p before %p\" violated\n", (Int)xe->XE.LockOrder.thr->errmsg_index, - (void*)xe->XE.LockOrder.shouldbe_earlier_ga, - (void*)xe->XE.LockOrder.shouldbe_later_ga ); + (void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr, + (void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr ); emit( "\n" ); emit( "Observed (incorrect) order is: " "acquisition of lock at %p\n", - (void*)xe->XE.LockOrder.shouldbe_later_ga); + (void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr); if (xe->XE.LockOrder.actual_earlier_ec) { VG_(pp_ExeContext)(xe->XE.LockOrder.actual_earlier_ec); } else { @@ -983,20 +994,23 @@ void HG_(pp_Error) ( Error* err ) } emit( "\n" ); emit(" followed by a later acquisition of lock at %p\n", - (void*)xe->XE.LockOrder.shouldbe_earlier_ga); + (void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); if (xe->XE.LockOrder.shouldbe_earlier_ec && xe->XE.LockOrder.shouldbe_later_ec) { emit("\n"); emit( "Required order was established by " "acquisition of lock at %p\n", - (void*)xe->XE.LockOrder.shouldbe_earlier_ga ); + (void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr ); VG_(pp_ExeContext)( xe->XE.LockOrder.shouldbe_earlier_ec ); emit( "\n" ); emit( " followed by a later acquisition of lock at %p\n", - (void*)xe->XE.LockOrder.shouldbe_later_ga ); + (void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr ); VG_(pp_ExeContext)( xe->XE.LockOrder.shouldbe_later_ec ); } + emit("\n"); + announce_LockP ( xe->XE.LockOrder.shouldbe_earlier_lk ); + announce_LockP ( xe->XE.LockOrder.shouldbe_later_lk ); } @@ -1080,12 +1094,7 @@ void HG_(pp_Error) ( Error* err ) (Int)xe->XE.UnlockForeign.owner->errmsg_index ); emit( " \n" ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); - - if (xe->XE.UnlockForeign.lock->appeared_at) { - emit( " Lock at %p was first observed\n", - (void*)xe->XE.UnlockForeign.lock->guestaddr ); - VG_(pp_ExeContext)( xe->XE.UnlockForeign.lock->appeared_at ); - } + announce_LockP ( xe->XE.UnlockForeign.lock ); } else { @@ -1095,11 +1104,7 @@ void HG_(pp_Error) ( Error* err ) (void*)xe->XE.UnlockForeign.lock->guestaddr, (Int)xe->XE.UnlockForeign.owner->errmsg_index ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); - if (xe->XE.UnlockForeign.lock->appeared_at) { - emit( " Lock at %p was first observed\n", - (void*)xe->XE.UnlockForeign.lock->guestaddr ); - VG_(pp_ExeContext)( xe->XE.UnlockForeign.lock->appeared_at ); - } + announce_LockP ( xe->XE.UnlockForeign.lock ); } @@ -1121,11 +1126,7 @@ void HG_(pp_Error) ( Error* err ) (Int)xe->XE.UnlockUnlocked.thr->errmsg_index ); emit( " \n" ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); - if (xe->XE.UnlockUnlocked.lock->appeared_at) { - emit( " Lock at %p was first observed\n", - (void*)xe->XE.UnlockUnlocked.lock->guestaddr ); - VG_(pp_ExeContext)( xe->XE.UnlockUnlocked.lock->appeared_at ); - } + announce_LockP ( xe->XE.UnlockUnlocked.lock); } else { @@ -1133,11 +1134,7 @@ void HG_(pp_Error) ( Error* err ) (Int)xe->XE.UnlockUnlocked.thr->errmsg_index, (void*)xe->XE.UnlockUnlocked.lock->guestaddr ); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); - if (xe->XE.UnlockUnlocked.lock->appeared_at) { - emit( " Lock at %p was first observed\n", - (void*)xe->XE.UnlockUnlocked.lock->guestaddr ); - VG_(pp_ExeContext)( xe->XE.UnlockUnlocked.lock->appeared_at ); - } + announce_LockP ( xe->XE.UnlockUnlocked.lock); } diff --git a/helgrind/hg_errors.h b/helgrind/hg_errors.h index 02c8f50e77..03a6086bd9 100644 --- a/helgrind/hg_errors.h +++ b/helgrind/hg_errors.h @@ -63,7 +63,7 @@ void HG_(record_error_PthAPIerror) ( Thread*, const HChar*, Word, const HChar* ); /* see the implementation for meaning of these params */ -void HG_(record_error_LockOrder) ( Thread*, Addr, Addr, +void HG_(record_error_LockOrder) ( Thread*, Lock*, Lock*, ExeContext*, ExeContext*, ExeContext* ); diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 65b045b41f..4a3005f7a8 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -3802,7 +3802,7 @@ static void laog__pre_thread_acquires_lock ( tl_assert(found->src_ec); tl_assert(found->dst_ec); HG_(record_error_LockOrder)( - thr, lk->guestaddr, other->guestaddr, + thr, lk, other, found->src_ec, found->dst_ec, other->acquired_at ); } else { /* Hmm. This can't happen (can it?) */ @@ -3852,7 +3852,7 @@ static void laog__pre_thread_acquires_lock ( held by this thread, with its 'acquired_at'. */ HG_(record_error_LockOrder)( - thr, lk->guestaddr, other->guestaddr, + thr, lk, other, NULL, NULL, other->acquired_at ); } } diff --git a/helgrind/tests/annotate_rwlock.stderr.exp b/helgrind/tests/annotate_rwlock.stderr.exp index 9392d39397..1eefc2dcad 100644 --- a/helgrind/tests/annotate_rwlock.stderr.exp +++ b/helgrind/tests/annotate_rwlock.stderr.exp @@ -99,7 +99,7 @@ Locks held: none ---------------------------------------------------------------- -Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: rwlock_init (annotate_rwlock.c:54) by 0x........: main (annotate_rwlock.c:161) Address 0x........ is 0 bytes inside data symbol "s_rwlock" diff --git a/helgrind/tests/hg02_deadlock.stderr.exp b/helgrind/tests/hg02_deadlock.stderr.exp index 1c33b31a63..9ec5a8b51f 100644 --- a/helgrind/tests/hg02_deadlock.stderr.exp +++ b/helgrind/tests/hg02_deadlock.stderr.exp @@ -34,5 +34,18 @@ Required order was established by acquisition of lock at 0x........ by 0x........: mythread_wrapper (hg_intercepts.c:...) ... + Lock at 0x........ was first observed + at 0x........: pthread_mutex_lock (hg_intercepts.c:...) + by 0x........: main (hg02_deadlock.c:32) + Address 0x........ is 0 bytes inside data symbol "m1" + + Lock at 0x........ was first observed + at 0x........: pthread_mutex_lock (hg_intercepts.c:...) + by 0x........: t1 (hg02_deadlock.c:10) + by 0x........: mythread_wrapper (hg_intercepts.c:...) + ... + Address 0x........ is 0 bytes inside data symbol "m2" + + ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) diff --git a/helgrind/tests/locked_vs_unlocked1_fwd.stderr.exp b/helgrind/tests/locked_vs_unlocked1_fwd.stderr.exp index 43193988ea..42ff5aa888 100644 --- a/helgrind/tests/locked_vs_unlocked1_fwd.stderr.exp +++ b/helgrind/tests/locked_vs_unlocked1_fwd.stderr.exp @@ -14,7 +14,7 @@ Thread #x was created ---------------------------------------------------------------- -Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_lock (hg_intercepts.c:...) by 0x........: child_fn (locked_vs_unlocked1.c:18) by 0x........: mythread_wrapper (hg_intercepts.c:...) diff --git a/helgrind/tests/locked_vs_unlocked1_rev.stderr.exp b/helgrind/tests/locked_vs_unlocked1_rev.stderr.exp index bcf728cfaa..4eec5624b8 100644 --- a/helgrind/tests/locked_vs_unlocked1_rev.stderr.exp +++ b/helgrind/tests/locked_vs_unlocked1_rev.stderr.exp @@ -14,7 +14,7 @@ Thread #x was created ---------------------------------------------------------------- -Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_lock (hg_intercepts.c:...) by 0x........: child_fn (locked_vs_unlocked1.c:18) by 0x........: mythread_wrapper (hg_intercepts.c:...) diff --git a/helgrind/tests/locked_vs_unlocked2.stderr.exp b/helgrind/tests/locked_vs_unlocked2.stderr.exp index b4051fd93f..3463b54177 100644 --- a/helgrind/tests/locked_vs_unlocked2.stderr.exp +++ b/helgrind/tests/locked_vs_unlocked2.stderr.exp @@ -14,17 +14,17 @@ Thread #x was created ---------------------------------------------------------------- -Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: main (locked_vs_unlocked2.c:58) Address 0x........ is 0 bytes inside data symbol "mx2a" -Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: main (locked_vs_unlocked2.c:59) Address 0x........ is 0 bytes inside data symbol "mx2b" -Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: main (locked_vs_unlocked2.c:57) Address 0x........ is 0 bytes inside data symbol "mx1b" diff --git a/helgrind/tests/locked_vs_unlocked3.stderr.exp b/helgrind/tests/locked_vs_unlocked3.stderr.exp index 6e62ca73d1..75c06e637d 100644 --- a/helgrind/tests/locked_vs_unlocked3.stderr.exp +++ b/helgrind/tests/locked_vs_unlocked3.stderr.exp @@ -14,7 +14,7 @@ Thread #x was created ---------------------------------------------------------------- -Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: main (locked_vs_unlocked3.c:51) Address 0x........ is 0 bytes inside data symbol "mx" diff --git a/helgrind/tests/tc09_bad_unlock.stderr.exp b/helgrind/tests/tc09_bad_unlock.stderr.exp index 0da7639bd8..bb4932489b 100644 --- a/helgrind/tests/tc09_bad_unlock.stderr.exp +++ b/helgrind/tests/tc09_bad_unlock.stderr.exp @@ -9,10 +9,13 @@ Thread #x unlocked a not-locked lock at 0x........ at 0x........: pthread_mutex_unlock (hg_intercepts.c:...) by 0x........: nearly_main (tc09_bad_unlock.c:27) by 0x........: main (tc09_bad_unlock.c:49) - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: nearly_main (tc09_bad_unlock.c:23) by 0x........: main (tc09_bad_unlock.c:49) + Address 0x........ is on thread #x's stack + in frame #x, created by nearly_main (tc09_bad_unlock.c:16) + ---Thread-Announcement------------------------------------------ @@ -29,10 +32,13 @@ Thread #x unlocked lock at 0x........ currently held by thread #x by 0x........: child_fn (tc09_bad_unlock.c:11) by 0x........: mythread_wrapper (hg_intercepts.c:...) ... - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: nearly_main (tc09_bad_unlock.c:31) by 0x........: main (tc09_bad_unlock.c:49) + Address 0x........ is on thread #x's stack + in frame #x, created by nearly_main (tc09_bad_unlock.c:16) + ---------------------------------------------------------------- @@ -56,10 +62,13 @@ Thread #x unlocked a not-locked lock at 0x........ at 0x........: pthread_mutex_unlock (hg_intercepts.c:...) by 0x........: nearly_main (tc09_bad_unlock.c:27) by 0x........: main (tc09_bad_unlock.c:50) - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: nearly_main (tc09_bad_unlock.c:23) by 0x........: main (tc09_bad_unlock.c:49) + Address 0x........ is on thread #x's stack + in frame #x, created by nearly_main (tc09_bad_unlock.c:16) + ---------------------------------------------------------------- @@ -94,10 +103,13 @@ Thread #x unlocked lock at 0x........ currently held by thread #x by 0x........: child_fn (tc09_bad_unlock.c:11) by 0x........: mythread_wrapper (hg_intercepts.c:...) ... - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: nearly_main (tc09_bad_unlock.c:31) by 0x........: main (tc09_bad_unlock.c:49) + Address 0x........ is on thread #x's stack + in frame #x, created by nearly_main (tc09_bad_unlock.c:16) + ---------------------------------------------------------------- diff --git a/helgrind/tests/tc10_rec_lock.stderr.exp b/helgrind/tests/tc10_rec_lock.stderr.exp index 93eeee3f80..0f52b3f09f 100644 --- a/helgrind/tests/tc10_rec_lock.stderr.exp +++ b/helgrind/tests/tc10_rec_lock.stderr.exp @@ -16,10 +16,13 @@ Thread #x unlocked a not-locked lock at 0x........ at 0x........: pthread_mutex_unlock (hg_intercepts.c:...) by 0x........: nearly_main (tc10_rec_lock.c:42) by 0x........: main (tc10_rec_lock.c:47) - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_mutex_init (hg_intercepts.c:...) by 0x........: nearly_main (tc10_rec_lock.c:24) by 0x........: main (tc10_rec_lock.c:47) + Address 0x........ is on thread #x's stack + in frame #x, created by nearly_main (tc10_rec_lock.c:15) + ---------------------------------------------------------------- diff --git a/helgrind/tests/tc12_rwl_trivial.stderr.exp b/helgrind/tests/tc12_rwl_trivial.stderr.exp index ff8cd7cc8f..361a4d6777 100644 --- a/helgrind/tests/tc12_rwl_trivial.stderr.exp +++ b/helgrind/tests/tc12_rwl_trivial.stderr.exp @@ -9,10 +9,13 @@ Thread #x unlocked a not-locked lock at 0x........ at 0x........: pthread_rwlock_unlock_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_unlock (hg_intercepts.c:...) by 0x........: main (tc12_rwl_trivial.c:35) - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_init (hg_intercepts.c:...) by 0x........: main (tc12_rwl_trivial.c:24) + Address 0x........ is on thread #x's stack + in frame #x, created by main (tc12_rwl_trivial.c:20) + ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) diff --git a/helgrind/tests/tc13_laog1.stderr.exp b/helgrind/tests/tc13_laog1.stderr.exp index 756300f282..3e56f251c0 100644 --- a/helgrind/tests/tc13_laog1.stderr.exp +++ b/helgrind/tests/tc13_laog1.stderr.exp @@ -23,5 +23,18 @@ Required order was established by acquisition of lock at 0x........ at 0x........: pthread_mutex_lock (hg_intercepts.c:...) by 0x........: main (tc13_laog1.c:18) + Lock at 0x........ was first observed + at 0x........: pthread_mutex_init (hg_intercepts.c:...) + by 0x........: main (tc13_laog1.c:14) + Address 0x........ is on thread #x's stack + in frame #x, created by main (tc13_laog1.c:11) + + Lock at 0x........ was first observed + at 0x........: pthread_mutex_init (hg_intercepts.c:...) + by 0x........: main (tc13_laog1.c:15) + Address 0x........ is on thread #x's stack + in frame #x, created by main (tc13_laog1.c:11) + + ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) diff --git a/helgrind/tests/tc14_laog_dinphils.c b/helgrind/tests/tc14_laog_dinphils.c index c5af8c1078..ad45f693e8 100644 --- a/helgrind/tests/tc14_laog_dinphils.c +++ b/helgrind/tests/tc14_laog_dinphils.c @@ -2,12 +2,15 @@ #include #include #include - +#include /* Naive dining philosophers with inconsistent lock acquisition ordering. */ static pthread_t phil[5]; -static pthread_mutex_t chop[5]; +static struct { + pthread_mutex_t m; + char pad[120 - sizeof(pthread_mutex_t)]; +} chop[5]; void* dine ( void* arg ) { @@ -15,11 +18,11 @@ void* dine ( void* arg ) long left = (long)arg; long right = (left + 1) % 5; for (i = 0; i < 1000/*arbitrary*/; i++) { - pthread_mutex_lock(&chop[left]); - pthread_mutex_lock(&chop[right]); + pthread_mutex_lock(&chop[left].m); + pthread_mutex_lock(&chop[right].m); /* eating */ - pthread_mutex_unlock(&chop[left]); - pthread_mutex_unlock(&chop[right]); + pthread_mutex_unlock(&chop[left].m); + pthread_mutex_unlock(&chop[right].m); } return NULL; } @@ -27,8 +30,10 @@ void* dine ( void* arg ) int main ( void ) { long i; + assert(sizeof(pthread_mutex_t) <= 120); + for (i = 0; i < 5; i++) - pthread_mutex_init( &chop[i], NULL); + pthread_mutex_init( &chop[i].m, NULL); for (i = 0; i < 5; i++) pthread_create(&phil[i], NULL, dine, (void*)i ); diff --git a/helgrind/tests/tc14_laog_dinphils.stderr.exp b/helgrind/tests/tc14_laog_dinphils.stderr.exp index bcc5c745da..3bf02bf628 100644 --- a/helgrind/tests/tc14_laog_dinphils.stderr.exp +++ b/helgrind/tests/tc14_laog_dinphils.stderr.exp @@ -4,7 +4,7 @@ Thread #x was created ... by 0x........: pthread_create@* (hg_intercepts.c:...) - by 0x........: main (tc14_laog_dinphils.c:34) + by 0x........: main (tc14_laog_dinphils.c:39) ---------------------------------------------------------------- @@ -12,15 +12,26 @@ Thread #x: lock order "0x........ before 0x........" violated Observed (incorrect) order is: acquisition of lock at 0x........ at 0x........: pthread_mutex_lock (hg_intercepts.c:...) - by 0x........: dine (tc14_laog_dinphils.c:18) + by 0x........: dine (tc14_laog_dinphils.c:21) by 0x........: mythread_wrapper (hg_intercepts.c:...) ... followed by a later acquisition of lock at 0x........ at 0x........: pthread_mutex_lock (hg_intercepts.c:...) - by 0x........: dine (tc14_laog_dinphils.c:19) + by 0x........: dine (tc14_laog_dinphils.c:22) by 0x........: mythread_wrapper (hg_intercepts.c:...) ... + Lock at 0x........ was first observed + at 0x........: pthread_mutex_init (hg_intercepts.c:...) + by 0x........: main (tc14_laog_dinphils.c:36) + Address 0x........ is 0 bytes inside data symbol "chop" + + Lock at 0x........ was first observed + at 0x........: pthread_mutex_init (hg_intercepts.c:...) + by 0x........: main (tc14_laog_dinphils.c:36) + Address 0x........ is 480 bytes inside data symbol "chop" + + ERROR SUMMARY: 1000 errors from 1 contexts (suppressed: 0 from 0) diff --git a/helgrind/tests/tc15_laog_lockdel.c b/helgrind/tests/tc15_laog_lockdel.c index 68668b188a..5b2607d39b 100644 --- a/helgrind/tests/tc15_laog_lockdel.c +++ b/helgrind/tests/tc15_laog_lockdel.c @@ -12,9 +12,9 @@ int main ( void ) { int r; pthread_mutex_t *mx1, *mx2; - - mx1 = malloc(sizeof(pthread_mutex_t)); - mx2 = malloc(sizeof(pthread_mutex_t)); + assert (sizeof(pthread_mutex_t) <= 120); + mx1 = malloc(120 + sizeof(pthread_mutex_t) - sizeof(pthread_mutex_t)); + mx2 = malloc(120 + sizeof(pthread_mutex_t) - sizeof(pthread_mutex_t)); assert(mx1); assert(mx2); diff --git a/helgrind/tests/tc15_laog_lockdel.stderr.exp b/helgrind/tests/tc15_laog_lockdel.stderr.exp index 675b95b35b..945010e132 100644 --- a/helgrind/tests/tc15_laog_lockdel.stderr.exp +++ b/helgrind/tests/tc15_laog_lockdel.stderr.exp @@ -25,6 +25,23 @@ Required order was established by acquisition of lock at 0x........ at 0x........: pthread_mutex_lock (hg_intercepts.c:...) by 0x........: main (tc15_laog_lockdel.c:28) + Lock at 0x........ was first observed + at 0x........: pthread_mutex_init (hg_intercepts.c:...) + by 0x........: main (tc15_laog_lockdel.c:22) + Address 0x........ is 0 bytes inside a block of size 120 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (tc15_laog_lockdel.c:16) + Block was alloc'd by thread #x + + Lock at 0x........ was first observed + at 0x........: pthread_mutex_init (hg_intercepts.c:...) + by 0x........: main (tc15_laog_lockdel.c:23) + Address 0x........ is 0 bytes inside a block of size 120 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (tc15_laog_lockdel.c:17) + Block was alloc'd by thread #x + + Free 2 and re-allocate it. This gives it a new identity, so a second locking sequence 2 -> 1 should now be OK. done diff --git a/helgrind/tests/tc20_verifywrap.stderr.exp b/helgrind/tests/tc20_verifywrap.stderr.exp index aaab563bd0..4d9f4c4db9 100644 --- a/helgrind/tests/tc20_verifywrap.stderr.exp +++ b/helgrind/tests/tc20_verifywrap.stderr.exp @@ -157,10 +157,13 @@ Thread #x unlocked a not-locked lock at 0x........ at 0x........: pthread_rwlock_unlock_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_unlock (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:179) - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_init (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:178) + Location 0x........ is 0 bytes inside local var "rwl" + declared at tc20_verifywrap.c:47, in frame #x of thread x + (1) no error on next line (2) no error on next line @@ -171,10 +174,13 @@ Thread #x unlocked a not-locked lock at 0x........ at 0x........: pthread_rwlock_unlock_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_unlock (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:196) - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_init (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:186) + Location 0x........ is 0 bytes inside local var "rwl2" + declared at tc20_verifywrap.c:48, in frame #x of thread x + (4) no error on next line (5) no error on next line @@ -187,10 +193,13 @@ Thread #x unlocked a not-locked lock at 0x........ at 0x........: pthread_rwlock_unlock_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_unlock (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:212) - Lock at 0x........ was first observed + Lock at 0x........ was first observed at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...) by 0x........: pthread_rwlock_init (hg_intercepts.c:...) by 0x........: main (tc20_verifywrap.c:186) + Location 0x........ is 0 bytes inside local var "rwl2" + declared at tc20_verifywrap.c:48, in frame #x of thread x + ---------------- sem_* ----------------