线程清理程序拒绝数据争用时如何添加断点? [英] How to add breakpoint when thread sanitizer repoorts data-race?

查看:61
本文介绍了线程清理程序拒绝数据争用时如何添加断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

地址清理器也有类似的问题,但是对于线程清理器,它不起作用,我试图中断__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.

推荐答案

  1. 在GDB下运行程序,在 exit _exit 上设置断点.在Linux上,还要设置 catch syscall exit_group .
  2. TSAN_OPTIONS 中设置 halt_on_error = 1 ,以请求线程消毒剂在第一次错误时退出:
  1. Run the program under GDB, set breakpoints on exit and _exit. On Linux, also set catch syscall exit_group.
  2. set halt_on_error=1 in TSAN_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.

  1. 利润.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆