> --- coregrind/vg_proxylwp.c~  Mon Aug 23 15:47:33 2004
> +++ coregrind/vg_proxylwp.c   Mon Aug 23 15:48:42 2004
> @@ -596,6 +596,8 @@
>     static const vki_kstack_t ss = { .ss_flags = VKI_SS_DISABLE };
>  
>  #if __FreeBSD__ == 5
> +   VG_(message)(Vg_UserMsg, "Locking#1 mutex %p/%p", &px->mutex, px->mutex.u_owner);
>     VG_(do_syscall)(__NR__umtx_lock, &px->mutex);
> +   VG_(message)(Vg_UserMsg, "Done %p/%p", &px->mutex, px->mutex.u_owner);
>     px->mutex.u_owner |= UMTX_CONTESTED;
>     VG_(do_syscall)(__NR_thr_self, &px->lwp);
> @@ -943,6 +944,8 @@
>     px->exitcode = ret;
>  
>  #if __FreeBSD__ == 5
> +   VG_(message)(Vg_UserMsg, "Unlocking mutex %p/%p", &px->mutex, px->mutex.u_owner);
>     ret = VG_(do_syscall)(__NR__umtx_unlock, &px->mutex);
> +   VG_(message)(Vg_UserMsg, "Done %p/%p", &px->mutex, px->mutex.u_owner);
>     if (use_rfork)
>        VG_(do_syscall)(__NR_exit, 0);
> @@ -1171,7 +1173,11 @@
>  #if __FreeBSD__ == 5
>     if (block) {
>         if(proxy->lwp != 0)
> +       {
> +        VG_(message)(Vg_UserMsg, "Locking#2 mutex %p/%p", &proxy->mutex, 
> proxy->mutex.u_owner);
>          VG_(do_syscall)(__NR__umtx_lock, &proxy->mutex);
           ^^^^^^^^^^^^^^^^
           Commenting out this lock operation works for me. Did you
           notice that there are two places where the lock is acquired,
           and only one, where it is released?

           Perhaps the right solution would be to add another unlock
           operation...?
           
           Of course, I have no idea of valgrind internals, threading
           implementation on FreeBSD, umtx, etc. ;-D

> +        VG_(message)(Vg_UserMsg, "Done %p/%p", &proxy->mutex, proxy->mutex.u_owner);
> +       }
>  
>         if (status)
>          *status = proxy->exitcode;

Attachment: pgpEiQAEcbHxN.pgp
Description: PGP signature

Reply via email to