线程清理器的抑制文件不起作用:出了什么问题
Suppression file for ThreadSanitizer does not work: What is wrong?
Clang 具有-fsanitize-blacklist
编译开关来抑制来自线程清理器的警告。不幸的是,我无法让它工作。
下面是我想禁止显示的示例:
WARNING: ThreadSanitizer: data race (pid=21502)
Read of size 8 at 0x7f0dcf5b31a8 by thread T6:
#0 tbb::interface6::internal::auto_partition_type_base<tbb::interface6::internal::auto_partition_type>::check_being_stolen(tbb::task&) /usr/include/tbb/partitioner.h:305 (exe+0x000000388b38)
#1 <null> <null>:0 (libtbb.so.2+0x0000000224d9)
Previous write of size 8 at 0x7f0dcf5b31a8 by thread T1:
#0 auto_partition_type_base /usr/include/tbb/partitioner.h:299 (exe+0x000000388d9a)
#1 <null> <null>:0 (libtbb.so.2+0x0000000224d9)
#2 GhostSearch::Ghost3Search::SearchTask::execute_impl() /home/phil/ghost/search/ghost3/ghost3_search_alg.cpp:1456 (exe+0x000000387a8a)
#3 <null> <null>:0 (libtbb.so.2+0x0000000224d9)
#4 GhostSearch::Ghost3Search::Ghost3SearchAlg::NullWindowSearch(int, MOVE, int, std::vector<MOVE, std::allocator<MOVE> >&) /home/phil/ghost/search/ghost3/ghost3_search_alg.cpp:1640 (exe+0x000000388310)
#5 GhostSearch::PureMTDSearchAlg::FullWindowSearch(GhostSearch::SearchWindow, GhostSearch::SearchWindow, MOVE, int, std::vector<MOVE, std::allocator<MOVE> >&) /home/phil/ghost/search/pure_mtd_search_alg.cpp:41 (exe+0x000000370e3f)
#6 GhostSearch::PureSearchAlgWrapper::RequestHandlerThread::EnterHandlerMainLoop() /home/phil/ghost/search/pure_search_alg_wrapper.cpp:124 (exe+0x000000372d1b)
#7 operator() /home/phil/ghost/search/pure_search_alg_wrapper.cpp:94 (exe+0x000000374683)
#8 execute_native_thread_routine /home/phil/tmp/gcc/src/gcc-4.8-20130725/libstdc++-v3/src/c++11/thread.cc:84 (libstdc++.so.6+0x0000000b26cf)
Thread T6 (tid=21518, running) created by thread T3 at:
#0 pthread_create ??:0 (exe+0x0000002378e1)
#1 <null> <null>:0 (libtbb.so.2+0x0000000198c0)
Thread T1 (tid=21513, running) created by main thread at:
#0 pthread_create ??:0 (exe+0x0000002378e1)
#1 __gthread_create /home/phil/tmp/gcc/src/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu/bits/gthr-default.h:662 (libstdc++.so.6+0x0000000b291e)
#2 GhostSearch::PureSearchAlgWrapper::StartRequestHandlerThread() /home/phil/ghost/search/pure_search_alg_wrapper.cpp:77 (exe+0x0000003715c3)
#3 GhostSearch::Search::ExecuteSearch(GhostSearch::SEARCH_SETTINGS const&) /home/phil/ghost/search.cpp:243 (exe+0x00000033063f)
#4 GhostSearch::Search::StartSearch(GhostSearch::SEARCH_SETTINGS const&, UserBoard const&, GhostInterfaces::UserInterface*) /home/phil/ghost/search.cpp:176 (exe+0x00000033037a)
#5 GhostInterfaces::UserInterface::StartSearch(GhostSearch::SEARCH_SETTINGS const&, UserBoard const&) /home/phil/ghost/interface.cpp:1072 (exe+0x0000002ea220)
#6 GhostInterfaces::UserInterface::MainLoop() /home/phil/ghost/interface.cpp:576 (exe+0x0000002e9464)
#7 GhostInterfaces::Command_Analyze::Execute(GhostInterfaces::UserInterfaceData&) /home/phil/ghost/commands.cpp:1005 (exe+0x00000028756c)
#8 GhostInterfaces::UserInterface::FinishNextCommand() /home/phil/ghost/interface.cpp:1161 (exe+0x0000002e9ed0)
#9 GhostInterfaces::UserInterface::MainLoop() /home/phil/ghost/interface.cpp:571 (exe+0x0000002e9447)
#10 main /home/phil/ghost/ghost.cpp:54 (exe+0x000000274efd)
SUMMARY: ThreadSanitizer: data race /usr/include/tbb/partitioner.h:305 tbb::interface6::internal::auto_partition_type_base<tbb::interface6::internal::auto_partition_type>::check_being_stolen(tbb::task&)
到目前为止,我对抑制文件的尝试(但它不起作用):
# TBB
fun:tbb::*
src:/usr/include/tbb/partitioner.h
你知道为什么它不起作用吗?
(顺便说一下,我很乐意禁止来自 TBB 库的所有警告。
最后,我让它工作了。
根据文档,每行必须以有效的"suppression_type"开头(race
、thread
、mutex
、signal
、deadlock
或called_from_lib
)。
在我的示例中,正确的suppression_type是 race
.
下面是一个名为"sanitizer-thread-suppressions.txt"的示例文件,它抑制了两个已知包含数据争用的函数:
race:Function1
race:MyNamespace::Function2
要测试抑制文件,请设置TSAN_OPTIONS
环境变量并调用应用程序(使用 -fsanitize=thread
编译):
$ TSAN_OPTIONS="suppressions=sanitizer-thread-suppressions.txt" ./myapp
如果可行,您可以在编译时应用设置:
-fsanitize=thread -fsanitize-blacklist=sanitizer-thread-suppressions.txt
相关文章:
- 我的神经网络不起作用 [XOR 问题]
- 嵌套While循环不起作用(C++问题)
- N-queen问题:无法弄清楚为什么我的解决方案不起作用
- 使用 NTAllocateVirtualMemory 和 GetProcAddress 的内存分配问题不起作用
- 我正在尝试解决一个需要数组总和值但代码不起作用的问题,我想做这样的事情
- OpenGL中使用Freetype进行字体渲染的问题不起作用
- 使用 find() 通过 std::set 的迭代器将不起作用。出了什么问题?
- 画线不起作用,可能有什么问题?
- 从中间器转换字符串不起作用,出了什么问题?
- 正在处理约瑟夫斯问题,节点函数不起作用
- C++将字符串写入文本文件中的行;新行问题不起作用
- CMAKE:目标依赖项存在问题(add_dependency不起作用?
- 排序功能不起作用(字符串比较问题)
- 问题4.7.4 QPropertyAnimation不起作用
- 上层到下部不起作用,帮助我的代码出了什么问题
- 线程清理器的抑制文件不起作用:出了什么问题
- ActiveMQ 3.8.3 (CPP) 优先级备份的问题不起作用
- 取消引用运算符不起作用(语法问题?
- "int"与"double"的问题 - 为什么我的程序不起作用?
- 关于指针和重载的问题(.append() 在一行中不起作用)