]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, testsuite: Rename set_sanitizer procedures to append_environment.
authorChristina Schimpe <christina.schimpe@intel.com>
Wed, 12 Jun 2024 08:23:11 +0000 (04:23 -0400)
committerChristina Schimpe <christina.schimpe@intel.com>
Thu, 13 Feb 2025 16:51:13 +0000 (16:51 +0000)
The procedures set_sanitizer_1, set_sanitizer and set_sanitizer_default
are used for the configuration of ASAN specific environment variables.
However, they are actually generic.  Rename them to append_environment*
so that their purpose is more clear.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/libsegfault.exp
gdb/testsuite/gdb.dap/memory.exp
gdb/testsuite/gdb.python/py-inferior.exp
gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
gdb/testsuite/gdb.trace/basic-libipa.exp
gdb/testsuite/lib/gdb.exp

index 2c16fe8932a62e9f5ff1bad87363fec4ace825ab..61a54ff9ffeec86ba820f3b825aaa0179c3399eb 100644 (file)
@@ -42,7 +42,7 @@ proc gdb_spawn_with_ld_preload {lib cmdline_opts} {
        # ASan runtime does not come first in initial library list; you should
        # either link runtime to your application or manually preload it with
        # LD_PRELOAD.
-       set_sanitizer_default ASAN_OPTIONS verify_asan_link_order 0
+       append_environment_default ASAN_OPTIONS verify_asan_link_order 0
 
        gdb_spawn_with_cmdline_opts $cmdline_opts
     }
index 89ae8bb7b1a3ba681281906900ac2df3cfd6bd39..41f4f8de1a84489fafd5577a3a1b732cb3c91c22 100644 (file)
@@ -29,8 +29,8 @@ 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
+    append_environment ASAN_OPTIONS allocator_may_return_null 1
+    append_environment TSAN_OPTIONS allocator_may_return_null 1
 
     if {[dap_initialize] == ""} {
        return
index 58475bded0f4d18971cf9cc4ae684c3e06d906fa..dbde7fe1f34fcf256735c575bde7a72634937b58 100644 (file)
@@ -32,8 +32,8 @@ save_vars { env(ASAN_OPTIONS) env(TSAN_OPTIONS) } {
     # 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
+    append_environment ASAN_OPTIONS allocator_may_return_null 1
+    append_environment TSAN_OPTIONS allocator_may_return_null 1
 
     clean_restart ${testfile}
 }
index 28d70daad8c5d0142b5c0b24361e9db338eb2c81..942088f6f6f2aa4834e8661765dcd60f2457b1ee 100644 (file)
@@ -83,7 +83,7 @@ proc gdb_spawn_with_ld_preload {lib} {
        # ASan runtime does not come first in initial library list; you should
        # either link runtime to your application or manually preload it with
        # LD_PRELOAD.
-       set_sanitizer_default ASAN_OPTIONS verify_asan_link_order 0
+       append_environment_default ASAN_OPTIONS verify_asan_link_order 0
 
        gdb_start
     }
index dcde297365f16c11a0205e4cecf4124aa831a498..0da94af9a4de58b998a3bfdc0bf31b6643fa0b57 100644 (file)
@@ -40,7 +40,7 @@ save_vars { env(ASAN_OPTIONS) } {
     # ASan runtime does not come first in initial library list; you should
     # either link runtime to your application or manually preload it with
     # LD_PRELOAD.
-    set_sanitizer_default ASAN_OPTIONS verify_asan_link_order 0
+    append_environment_default ASAN_OPTIONS verify_asan_link_order 0
 
     clean_restart $binfile
 }
index 830d702c6326862253b33659e9ba25a1f40c5b5d..d4634c857254ae6102242299936250a595986996 100644 (file)
@@ -45,9 +45,9 @@ proc cond_wrap { cond wrap body } {
     }
 }
 
-# Helper function for set_sanitizer/set_sanitizer_default.
+# Helper function for append_environment/append_environment_default.
 
-proc set_sanitizer_1 { env_var var_id val default} {
+proc append_environment_1 { env_var var_id val default} {
     global env
 
     if { ![info exists env($env_var) ]
@@ -70,17 +70,17 @@ proc set_sanitizer_1 { env_var var_id val default} {
 
 # Add VAR_ID=VAL to ENV_VAR.
 
-proc set_sanitizer { env_var var_id val } {
-    set_sanitizer_1 $env_var $var_id $val 0
+proc append_environment { env_var var_id val } {
+    append_environment_1 $env_var $var_id $val 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 } {
-    set_sanitizer_1 $env_var $var_id $val 1
+proc append_environment_default { env_var var_id val } {
+    append_environment_1 $env_var $var_id $val 1
 }
 
-set_sanitizer_default TSAN_OPTIONS suppressions \
+append_environment_default TSAN_OPTIONS suppressions \
     $srcdir/../tsan-suppressions.txt
 
 # When using ThreadSanitizer we may run into the case that a race is detected,
@@ -89,14 +89,14 @@ set_sanitizer_default TSAN_OPTIONS suppressions \
 # 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
+append_environment_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
 # exit status.  Add `detect_leaks=0` to the ASAN_OPTIONS environment variable
 # (which will affect any spawned sub-process) to avoid this.
-set_sanitizer_default ASAN_OPTIONS detect_leaks 0
+append_environment_default ASAN_OPTIONS detect_leaks 0
 
 # List of procs to run in gdb_finish.
 set gdb_finish_hooks [list]