gcc v4.8.x add options for debugging your program:
-fsanitize = thread
Enable ThreadSanitizer, a fast data race detector. The instructions for accessing the memory will be used to detect errors in the calculation of data. See http://code.google.com/p/data-race-test/wiki/ThreadSanitizer for details.
My gcc version on Fedora 19:
gcc version 4.8.1 20130603 (Red Hat 4.8.1-1) (GCC)
Associate my program with the command below (CMake output):
Linking C executable bin/ftu /usr/bin/cmake -E cmake_link_script CMakeFiles/ftu.dir/link.txt
Gcc says, "Can't find -ltsan." Where is the liban?
I found something at http://gcc.gnu.org/gcc-4.8/changes.html :
ThreadSanitizer is added and can be enabled via -fsanitize = thread. The instructions will be designed to detect racing data. ThreadSanitizer is available on x86-64 GNU / Linux.
-fsanitize = thread is supported only on a 64-bit processor. My output is linux uname -a :
Linux hl.zy 3.9.8-300.fc19.i686 # 1 SMP Thu Jun 27 19:40:39 UTC 2013 i686 i686 i386 GNU / Linux
My processor is 32bit, it does not support! I'm right?
c gcc pthreads thread-sanitizer
husthl
source share