]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Add tsan-suppressions.txt
authorTom de Vries <tdevries@suse.de>
Tue, 12 Jul 2022 11:45:30 +0000 (13:45 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 12 Jul 2022 11:45:30 +0000 (13:45 +0200)
Add a new file tsan-suppressions.txt, to suppress the "unlock unlocked mutex"
problem in ncurses, filed in PR29328.

The file is added to the TSAN_OPTIONS in lib/gdb.exp.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29328

gdb/testsuite/lib/gdb.exp
gdb/tsan-suppressions.txt [new file with mode: 0644]

index a29b8f947c471191d5b1eb1da4c4a4c6f7cb90d0..698dd14504ebcab7a6225abc5bcd851e61a9c908 100644 (file)
@@ -32,6 +32,32 @@ if {$tool == ""} {
 # (which will affect any spawned sub-process) to avoid this.
 append ::env(ASAN_OPTIONS) ",detect_leaks=0"
 
+# Add VAR_ID=VAL to ENV_VAR, unless ENV_VAR already contains a VAR_ID setting.
+
+proc set_sanitizer_default { env_var var_id val } {
+    global env
+
+    if { ![info exists env($env_var) ]
+        || $env($env_var) == "" } {
+       # Set var_id (env_var non-existing / empty case).
+       append env($env_var) $var_id=$val
+       return
+    }
+
+    if { [regexp $var_id= $env($env_var)] } {
+       # Don't set var_id.  It's already set by the user, leave as is.
+       # Note that we could probably get the same result by unconditionally
+       # prepending it, but this way is less likely to cause confusion.
+       return
+    }
+
+    # Set var_id (env_var not empty case).
+    append env($env_var) : $var_id=$val
+}
+
+set_sanitizer_default TSAN_OPTIONS suppressions \
+    $srcdir/../tsan-suppressions.txt
+
 # List of procs to run in gdb_finish.
 set gdb_finish_hooks [list]
 
diff --git a/gdb/tsan-suppressions.txt b/gdb/tsan-suppressions.txt
new file mode 100644 (file)
index 0000000..5f1e5dc
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright (C) 2022 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Problem in ncurses, see:
+# - https://sourceware.org/bugzilla/show_bug.cgi?id=29328.
+# - https://lists.gnu.org/archive/html/bug-ncurses/2022-07/msg00002.html
+mutex:newterm