public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb] Add tsan-suppressions.txt
@ 2022-07-11 10:08 Tom de Vries
  2022-07-12  8:39 ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2022-07-11 10:08 UTC (permalink / raw)
  To: gdb-patches

Hi,

Add a new file tsan-suppressions.txt, to suppress the "unlock unlocked mutex"
problem in ncurses, filed in PR29328.

For now, one needs to specify it manually using something like:
...
$ export TSAN_OPTIONS=suppressions=$(pwd -P)/src/gdb/tsan-suppressions.txt
...

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

Any comments?

Thanks,
- Tom

[gdb] Add tsan-suppressions.txt

---
 gdb/tsan-suppressions.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gdb/tsan-suppressions.txt b/gdb/tsan-suppressions.txt
new file mode 100644
index 00000000000..5f1e5dc7ea7
--- /dev/null
+++ b/gdb/tsan-suppressions.txt
@@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb] Add tsan-suppressions.txt
  2022-07-11 10:08 [PATCH][gdb] Add tsan-suppressions.txt Tom de Vries
@ 2022-07-12  8:39 ` Tom de Vries
  2022-07-12 10:31   ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2022-07-12  8:39 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]

On 7/11/22 12:08, Tom de Vries wrote:
> Hi,
> 
> Add a new file tsan-suppressions.txt, to suppress the "unlock unlocked mutex"
> problem in ncurses, filed in PR29328.
> 
> For now, one needs to specify it manually using something like:
> ...
> $ export TSAN_OPTIONS=suppressions=$(pwd -P)/src/gdb/tsan-suppressions.txt
> ...
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29328
> 
> Any comments?
> 

I just found that we already set ASAN_OPTIONS in lib/gdb.exp, so I've 
added this TSAN_OPTIONS setting alongside.

Thanks,
- Tom

[-- Attachment #2: 0003-gdb-Add-tsan-suppressions.txt.patch --]
[-- Type: text/x-patch, Size: 2132 bytes --]

[gdb] Add tsan-suppressions.txt

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 |  9 +++++++++
 gdb/tsan-suppressions.txt | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index a29b8f947c4..49b00391729 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -32,6 +32,15 @@ if {$tool == ""} {
 # (which will affect any spawned sub-process) to avoid this.
 append ::env(ASAN_OPTIONS) ",detect_leaks=0"
 
+set tsan_suppressions suppressions=$srcdir/../tsan-suppressions.txt
+if { ![info exists env(TSAN_OPTIONS) ]
+     || $env(TSAN_OPTIONS) == "" } {
+    set env(TSAN_OPTIONS) "$tsan_suppressions"
+} else {
+    append env(TSAN_OPTIONS) ":$tsan_suppressions"
+}
+unset tsan_suppressions
+
 # 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
index 00000000000..5f1e5dc7ea7
--- /dev/null
+++ b/gdb/tsan-suppressions.txt
@@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][gdb] Add tsan-suppressions.txt
  2022-07-12  8:39 ` Tom de Vries
@ 2022-07-12 10:31   ` Tom de Vries
  2022-07-12 11:46     ` [committed][gdb] " Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2022-07-12 10:31 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

On 7/12/22 10:39, Tom de Vries wrote:
> On 7/11/22 12:08, Tom de Vries wrote:
>> Hi,
>>
>> Add a new file tsan-suppressions.txt, to suppress the "unlock unlocked 
>> mutex"
>> problem in ncurses, filed in PR29328.
>>
>> For now, one needs to specify it manually using something like:
>> ...
>> $ export TSAN_OPTIONS=suppressions=$(pwd 
>> -P)/src/gdb/tsan-suppressions.txt
>> ...
>>
>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29328
>>
>> Any comments?
>>
> 
> I just found that we already set ASAN_OPTIONS in lib/gdb.exp, so I've 
> added this TSAN_OPTIONS setting alongside.

I furthermore realized that suppression files are not cumulative, so if 
we have suppressions=a.txt:suppressions=b.txt then only b.txt is used.

This would mean we ignore any user-specified suppression files, which 
may contains more suppressions for whatever reason.

So I've updated the patch to only add the suppressions if the user 
didn't already do that.

Thanks,
- Tom

[-- Attachment #2: 0006-gdb-Add-tsan-suppressions.txt.patch --]
[-- Type: text/x-patch, Size: 2642 bytes --]

[gdb] Add tsan-suppressions.txt

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 | 26 ++++++++++++++++++++++++++
 gdb/tsan-suppressions.txt | 18 ++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index a29b8f947c4..698dd14504e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -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
index 00000000000..5f1e5dc7ea7
--- /dev/null
+++ b/gdb/tsan-suppressions.txt
@@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [committed][gdb] Add tsan-suppressions.txt
  2022-07-12 10:31   ` Tom de Vries
@ 2022-07-12 11:46     ` Tom de Vries
  0 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2022-07-12 11:46 UTC (permalink / raw)
  To: gdb-patches

On 7/12/22 12:31, Tom de Vries wrote:
> On 7/12/22 10:39, Tom de Vries wrote:
>> On 7/11/22 12:08, Tom de Vries wrote:
>>> Hi,
>>>
>>> Add a new file tsan-suppressions.txt, to suppress the "unlock 
>>> unlocked mutex"
>>> problem in ncurses, filed in PR29328.
>>>
>>> For now, one needs to specify it manually using something like:
>>> ...
>>> $ export TSAN_OPTIONS=suppressions=$(pwd 
>>> -P)/src/gdb/tsan-suppressions.txt
>>> ...
>>>
>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29328
>>>
>>> Any comments?
>>>
>>
>> I just found that we already set ASAN_OPTIONS in lib/gdb.exp, so I've 
>> added this TSAN_OPTIONS setting alongside.
> 
> I furthermore realized that suppression files are not cumulative, so if 
> we have suppressions=a.txt:suppressions=b.txt then only b.txt is used.
> 
> This would mean we ignore any user-specified suppression files, which 
> may contains more suppressions for whatever reason.
> 
> So I've updated the patch to only add the suppressions if the user 
> didn't already do that.

Well, that makes the whole thing harmless enough, so committed.

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-12 11:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 10:08 [PATCH][gdb] Add tsan-suppressions.txt Tom de Vries
2022-07-12  8:39 ` Tom de Vries
2022-07-12 10:31   ` Tom de Vries
2022-07-12 11:46     ` [committed][gdb] " Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).