Klaus
Klaus

Reputation: 25643

gdb and thread sanitizer gcc, how to stop on warning/error

I tried to run a program compiled with thread sanitizer under gdb control. I simply want to stop if an warning/error occurs.

From How to add breakpoint when thread sanitizer reports data-race? I found

(gdb) set env TSAN_OPTIONS=halt_on_error=1
(gdb) run

but it simply change nothing, the program reports a warning and continue until the program ends normally.

I looked in the symbols list of tsan and found __tsan::ReportRace. Setting a breakpoint to it will stop but before writing the warning which is bad. Stepping through it seems not very handy as it has thousands of lines. Even using "until" did not work as expected.

Q: How to work interactive with gdb and thread sanitizer and stop on each reported error/warning.

Upvotes: 0

Views: 120

Answers (0)

Related Questions