aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb.exp
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-07-31 21:35:35 +0200
committerTom de Vries <tdevries@suse.de>2023-07-31 21:35:35 +0200
commitfa2b9e04060b25f0338110798c08415081eab365 (patch)
tree34df42a2190a52058f319d3d4b58ba3c2d716974 /gdb/testsuite/lib/gdb.exp
parentfe34aba06029a86df15742b983cd398580ca3b94 (diff)
downloadbinutils-fa2b9e04060b25f0338110798c08415081eab365.zip
binutils-fa2b9e04060b25f0338110798c08415081eab365.tar.gz
binutils-fa2b9e04060b25f0338110798c08415081eab365.tar.bz2
[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 <tom@tromey.com> [1] https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags [2] https://groups.google.com/g/thread-sanitizer/c/VzSWE7UxhIE
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r--gdb/testsuite/lib/gdb.exp8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 12a9c59..87d6895 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -71,6 +71,14 @@ proc set_sanitizer_default { env_var var_id val } {
set_sanitizer_default TSAN_OPTIONS suppressions \
$srcdir/../tsan-suppressions.txt
+# When using ThreadSanitizer we may run 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 history_size to the maximum (7) by default.
+# See also the ThreadSanitizer docs (
+# https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags ).
+set_sanitizer_default TSAN_OPTIONS history_size 7
+
# If GDB is built with ASAN (and because there are leaks), it will output a
# leak report when exiting as well as exit with a non-zero (failure) status.
# This can affect tests that are sensitive to what GDB prints on stderr or its