|
From: Konstantin S. <kon...@gm...> - 2007-11-29 10:58:00
|
Hi,
I've found a small bug in helgrind:
$ cat tests/rwlock_bug.c
#define _GNU_SOURCE 1
#include <stdio.h>
#include <pthread.h>
#include <assert.h>
int main ( void )
{
pthread_rwlock_t rwl;
pthread_rwlock_init( &rwl, NULL );
pthread_rwlock_wrlock( &rwl );
// no unlock!
pthread_rwlock_destroy( &rwl );
return 0;
}
$ gcc -g tests/rwlock_bug.c -lpthread
$ ../Inst/bin/valgrind --tool=helgrind ./a.out
==13027== Thread #1: pthread_rwlock_destroy of a locked mutex
==13027== at 0x47A8A76: pthread_rwlock_destroy (hg_intercepts.c:778)
DIR:/home/kcc/valgrind/helgrind
==13027== by 0x8048474: main (rwlock_bug.c:11)
DIR:/home/kcc/valgrind/helgrind/tests
Helgrind: hg_main.c:6272 (evh__HG_PTHREAD_RWLOCK_DESTROY_PRE): Assertion
'is_sane_LockN(lk)' failed.
==13027== at 0x3801C206: report_and_quit (m_libcassert.c:140)
DIR:/home/kcc/valgrind/coregrind
==13027== by 0x3801C06A: vgPlain_assert_fail (m_libcassert.c:200)
DIR:/home/kcc/valgrind/coregrind
==13027== by 0x38014D86: evh__HG_PTHREAD_RWLOCK_DESTROY_PRE
(hg_main.c:6272) DIR:/home/kcc/valgrind/helgrind
==13027== by 0x38016A98: hg_handle_client_request (hg_main.c:7627)
DIR:/home/kcc/valgrind/helgrind
==13027== by 0x38036D03: do_client_request (scheduler.c:1380)
DIR:/home/kcc/valgrind/coregrind/m_scheduler
==13027== by 0x38037D5D: vgPlain_scheduler (scheduler.c:979)
DIR:/home/kcc/valgrind/coregrind/m_scheduler
==13027== by 0x3803AD03: run_a_thread_NORETURN (syswrap-linux.c:87)
DIR:/home/kcc/valgrind/coregrind/m_syswrap
The fix is probably to put lk->acquired_at = NULL; somewhere in
evh__HG_PTHREAD_RWLOCK_DESTROY_PRE.
Thanks,
--kcc
|
|
From: Julian S. <js...@ac...> - 2007-11-29 12:54:55
|
On Thursday 29 November 2007 11:58, Konstantin Serebryany wrote: > I've found a small bug in helgrind: Fixed (r7250). Thanks for that. J |