问题描述
地址清理器也有类似的问题,但是对于线程清理器,它不起作用,我试图中断__sanitizer_print_stack_trace,该方法也不起作用。
解决方法
- 在GDB下运行程序,在
exit
和_exit
上设置断点。在Linux上,还要设置catch syscall exit_group
。 - 在
halt_on_error=1
中设置TSAN_OPTIONS
,要求线程消毒剂进入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
命令查看如何报告错误。即使未设置__tsan_report_error
,也可以在堆栈上可能存在的某种halt_on_error
上设置断点。