线程清理程序拒绝数据争用时如何添加断点? [英] How to add breakpoint when thread sanitizer repoorts data-race?
本文介绍了线程清理程序拒绝数据争用时如何添加断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
地址清理器也有类似的问题,但是对于线程清理器,它不起作用,我试图中断__sanitizer_print_stack_trace,该方法也不起作用.
There is a similar question for address sanitizers, but for thread sanitizers, it doesn't work, I have tried to break on __sanitizer_print_stack_trace, which don't work either.
推荐答案
- 在GDB下运行程序,在
exit
和_exit
上设置断点.在Linux上,还要设置catch syscall exit_group
. - 在
TSAN_OPTIONS
中设置halt_on_error = 1
,以请求线程消毒剂在第一次错误时退出:
- Run the program under GDB, set breakpoints on
exit
and_exit
. On Linux, also setcatch syscall exit_group
. - set
halt_on_error=1
inTSAN_OPTIONS
to ask thread sanitizer to exit on first error:
(gdb) set env TSAN_OPTIONS=halt_on_error=1
(gdb) run
... error should be reported and one of the breakpoints should fire.
- 利润.
P.S.当达到断点时,使用GDB where
命令查看如何报告错误.即使不设置 halt_on_error
,也可以在堆栈上可能设置的某种 __ tsan_report_error
上设置断点.
P.S. When the breakpoint is hit, use GDB where
command to see how the error is reported. Setting a breakpoint on some kind of __tsan_report_error
that is likely on the stack will probably work even without setting halt_on_error
.
这篇关于线程清理程序拒绝数据争用时如何添加断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文