pthread_self() problem in DRD

Paul Floyd pjfloyd at wanadoo.fr
Sun Dec 20 08:42:51 UTC 2020


Soooo ...

Quicky test

paulf> LD_PRELOAD=/lib/libthr.so.3 ../../vg-in-place --tool=drd -q 
./dlopen_main ./dlopen_lib.so
In main: creating thread 1
Hello World! It's me, thread #1!

No assert, so I have a workaround at least

If I add


#if defined(VGO_freebsd)
    {
       dlclose(dlopen("/lib/libthr.so.3", 
RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE));
    }
#endif

Then I get

paulf> ../../vg-in-place --tool=drd -q ./dlopen_main ./dlopen_lib.so
In main: creating thread 1
Hello World! It's me, thread #1!
==22973== pthread_join(): invalid thread ID 0x5401570
==22973==    at 0x4860F29: pthread_join_intercept 
(drd_pthread_intercepts.c:731)
==22973==    by 0x4860F29: pthread_join (drd_pthread_intercepts.c:738)
==22973==    by 0x4CB47DC: foo (in 
/usr/home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so)
==22973==    by 0x201B38: main (dlopen_main.c:26)
==22973==

OK, so that's better than hitting the assert. Now I need to figure out 
why there is an extra call to pthread_join().


A+

Paul




More information about the freebsd-hackers mailing list