Skip to content

Commit fa2b9e0

Browse files
committed
[gdb/testsuite] Set TSAN_OPTIONS by default to history_size=7
I build gdb with -fsanitize=thread and ran the testsuite, and ran into the case that a race is detected, but we see the full stack trace only for one of the two accesses, and the other one is showing "failed to restore the stack". Try to prevent this by setting ThreadSanitizer flag history_size [1] to the maximum (7) by default, as suggested here [2]. Tested on x86_64-linux. Approved-By: Tom Tromey <[email protected]> [1] https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags [2] https://groups.google.com/g/thread-sanitizer/c/VzSWE7UxhIE
1 parent fe34aba commit fa2b9e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gdb/testsuite/lib/gdb.exp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ proc set_sanitizer_default { env_var var_id val } {
7171
set_sanitizer_default TSAN_OPTIONS suppressions \
7272
$srcdir/../tsan-suppressions.txt
7373

74+
# When using ThreadSanitizer we may run into the case that a race is detected,
75+
# but we see the full stack trace only for one of the two accesses, and the
76+
# other one is showing "failed to restore the stack".
77+
# Try to prevent this by setting history_size to the maximum (7) by default.
78+
# See also the ThreadSanitizer docs (
79+
# https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags ).
80+
set_sanitizer_default TSAN_OPTIONS history_size 7
81+
7482
# If GDB is built with ASAN (and because there are leaks), it will output a
7583
# leak report when exiting as well as exit with a non-zero (failure) status.
7684
# This can affect tests that are sensitive to what GDB prints on stderr or its

0 commit comments

Comments
 (0)