Closed paulfloyd closed 4 years ago
Made a few changes to the filter and added lots of expecteds. Still 3 fails
helgrind/tests/pth_cond_destroy_busy (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tls_threads (stderr)
Need to work on the filters more to reduce the number of expecteds.
This is not an issue with the codegen of the guest. I've tested this with the 4 combinations of host and guest compiled with GCC and clang, and the failure is always with the host compiled with clang.
The diff does not look too serious. Instead of (gcc)
==34086== ---Thread-Announcement------------------------------------------ ==34086== ==34086== Thread #2 was created ==34086== at 0x4D144BA: thr_new (in /lib/libc.so.7) ==34086== by 0x4C6639C: pthread_create (in /lib/libthr.so.3) ==34086== by 0x4A5098A: pthread_create_WRK (hg_intercepts.c:433) ==34086== by 0x4A5199C: pthread_create (hg_intercepts.c:472) ==34086== by 0x400935: main (tc01_simple_race.c:22)
we have (clang)
==37539== ---Thread-Announcement------------------------------------------ ==37539== ==37539== Thread #3 was created ==37539== at 0x491E4BA: thr_new (in /lib/libc.so.7) ==37539== by 0x487039C: pthread_create (in /lib/libthr.so.3) ==37539== by 0x4855B44: pthread_create_WRK (hg_intercepts.c:434) ==37539== by 0x400B7A: main (tc21_pthonce.c:87)
The essential information is there, just Helgrind's redirection is missing.
With GCC and turning on the debug flag in VG_(get_StackTrace_wrk) I see
whilst with clang that is
So this seems to be at the level of the stack unwinding.
On Linux I get the same kind of failure.
Back on FreeBSD Running the exe standalone, there's not much difference other than the address of main (0x00000000002014c4 for clang, 0x0000000000400b7b for GCC).
Looking at the codegen for the helgrind ldpreload and pthread_create there is
Hi
I've been looking at some differences that I get when building with clang.
One kind of difference that I see is that Helgrind displays one less element in callstacks. For instance with a GCC build I might get
==34086== ---Thread-Announcement------------------------------------------ ==34086== ==34086== Thread #2 was created ==34086== at 0x4D144BA: thr_new (in /lib/libc.so.7) ==34086== by 0x4C6639C: pthread_create (in /lib/libthr.so.3) ==34086== by 0x4A5098A: pthread_create_WRK (hg_intercepts.c:433) ==34086== by 0x4A5199C: pthread_create (hg_intercepts.c:472) ==34086== by 0x400935: main (tc01_simple_race.c:22)
but the same with a clang build gives
==37539== ---Thread-Announcement------------------------------------------ ==37539== ==37539== Thread #3 was created ==37539== at 0x491E4BA: thr_new (in /lib/libc.so.7) ==37539== by 0x487039C: pthread_create (in /lib/libthr.so.3) ==37539== by 0x4855B44: pthread_create_WRK (hg_intercepts.c:434) ==37539== by 0x400B7A: main (tc21_pthonce.c:87)
(note there is no pthread_create/hg_intercepts.c line).
I think that the cause of this is the clang codegen in the helgrind preload lib.
GCC
Clang
Clang not using callq/retq seems to be the cause of the stack difference. If I force "optnone" in hg_intercepts.c then this goes away.