pre*_*uin 4 gcc gdb thread-sanitizer
对于地址清理程序也有类似的问题,但对于线程清理程序,它不起作用,我尝试中断 __sanitizer_print_stack_trace,但它也不起作用。
exit和处设置断点_exit。在 Linux 上,还设置catch syscall exit_group.halt_on_error=1为TSAN_OPTIONS要求线程清理程序在出现第一个错误时退出:(gdb) set env TSAN_OPTIONS=halt_on_error=1
(gdb) run
... error should be reported and one of the breakpoints should fire.
Run Code Online (Sandbox Code Playgroud)
PS 断点时,使用GDBwhere命令查看如何报错。即使没有设置,在堆栈上可能存在的某种断点上设置断点__tsan_report_error也可能起作用halt_on_error。