1# this file simulates a program that has been built with ThreadSanitizer 2# options 3 4message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") 5string(REGEX REPLACE ".*log_path='([^']*)'.*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") 6message("LOG_FILE=[${LOG_FILE}]") 7 8set(error_types 9 "data race" 10 "data race on vptr (ctor/dtor vs virtual call)" 11 "heap-use-after-free" 12 "thread leak" 13 "destroy of a locked mutex" 14 "double lock of a mutex" 15 "unlock of an unlocked mutex (or by a wrong thread)" 16 "read lock of a write locked mutex" 17 "read unlock of a write locked mutex" 18 "signal-unsafe call inside of a signal" 19 "signal handler spoils errno" 20 "lock-order-inversion (potential deadlock)" 21 ) 22 23# clear the log file 24file(REMOVE "${LOG_FILE}.2343") 25 26# create an error of each type of thread santizer 27# these names come from tsan_report.cc in llvm 28foreach(error_type ${error_types} ) 29 30 file(APPEND "${LOG_FILE}.2343" 31"================== 32WARNING: ThreadSanitizer: ${error_type} (pid=27978) 33 Write of size 4 at 0x7fe017ce906c by thread T1: 34 #0 Thread1 ??:0 (exe+0x000000000bb0) 35 #1 <null> <null>:0 (libtsan.so.0+0x00000001b279) 36 37 Previous write of size 4 at 0x7fe017ce906c by main thread: 38 #0 main ??:0 (exe+0x000000000c3c) 39 40 Thread T1 (tid=27979, running) created by main thread at: 41 #0 <null> <null>:0 (libtsan.so.0+0x00000001ed7b) 42 #1 main ??:0 (exe+0x000000000c2c) 43 44SUMMARY: ThreadSanitizer: ${error_type} ??:0 Thread1 45================== 46") 47endforeach() 48