]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.python/py-inferior.exp with -fsanitize=thread
authorTom de Vries <tdevries@suse.de>
Mon, 7 Oct 2024 08:44:45 +0000 (10:44 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 7 Oct 2024 08:44:45 +0000 (10:44 +0200)
With a gdb build with -fsanitize=thread, and test-case
gdb.python/py-inferior.exp I run into:
...
(gdb) python gdb.selected_inferior().read_memory (0, 0xffffffffffffffff)^M
ERROR: ThreadSanitizer: requested allocation size 0xffffffffffffffff exceeds \
  maximum supported size of 0x10000000000^M
...

There's already a workaround for this using ASAN_OPTIONS, and apparently the
same is needed for TSAN_OPTIONS.

Add the allocator_may_return_null=1 workaround also in TSAN_OPTIONS.

Likewise in gdb.dap/memory.exp.

Tested on x86_64-linux.

gdb/testsuite/gdb.dap/memory.exp
gdb/testsuite/gdb.python/py-inferior.exp

index 7082706e11cb6505d59bbdb3e1bf31996fe0b897..c4e4fb3238b55f194a6041b6da8c427e47a58b4b 100644 (file)
@@ -25,11 +25,12 @@ if {[build_executable ${testfile}.exp $testfile] == -1} {
     return
 }
 
-save_vars { env(ASAN_OPTIONS) } {
+save_vars { env(ASAN_OPTIONS) env(TSAN_OPTIONS) } {
     # The request readMemory with count 18446744073709551615 triggers address
     # sanitizer.  Suppress the error, leaving us with just this warning:
     #   WARNING: AddressSanitizer failed to allocate 0xffffffffffffffff bytes
     set_sanitizer ASAN_OPTIONS allocator_may_return_null 1
+    set_sanitizer TSAN_OPTIONS allocator_may_return_null 1
 
     if {[dap_initialize] == ""} {
        return
index ee30390e29f704f1b5d5115f11f732a4e5cf7a3c..58475bded0f4d18971cf9cc4ae684c3e06d906fa 100644 (file)
@@ -27,12 +27,13 @@ if { [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable
 }
 
 # Start with a fresh gdb.
-save_vars { env(ASAN_OPTIONS) } {
+save_vars { env(ASAN_OPTIONS) env(TSAN_OPTIONS) } {
     # The call to gdb.selected_inferior().read_memory (0, 0xffffffffffffffff)
     # triggers address sanitizer.  Suppress the error, leaving us with just
     # this warning:
     #   WARNING: AddressSanitizer failed to allocate 0xffffffffffffffff bytes
     set_sanitizer ASAN_OPTIONS allocator_may_return_null 1
+    set_sanitizer TSAN_OPTIONS allocator_may_return_null 1
 
     clean_restart ${testfile}
 }