]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Run one more test-case with ASAN_OPTIONS=verify_asan_link_order=0
authorTom de Vries <tdevries@suse.de>
Thu, 9 Jan 2025 12:14:57 +0000 (13:14 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 9 Jan 2025 12:14:57 +0000 (13:14 +0100)
After building gdb with asan, and running test-case
gdb.trace/basic-libipa.exp, I got:
...
(gdb) run ^M
Starting program: basic-libipa ^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
==7705==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.^M
[Inferior 1 (process 7705) exited with code 01]^M
(gdb) FAIL: gdb.trace/basic-libipa.exp: runto: run to main
...

Fix this in the same way as in commit 75948417af8 ("[gdb/testsuite] Run two
test-cases with ASAN_OPTIONS=verify_asan_link_order=0").

Tested on x86_64-linux.

gdb/testsuite/gdb.trace/basic-libipa.exp

index c49192a5c355f67084751ce33fbeeea61b5b7121..dcde297365f16c11a0205e4cecf4124aa831a498 100644 (file)
@@ -30,11 +30,21 @@ set libipa [get_in_proc_agent]
 
 gdb_download_shlib $libipa
 
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
+if { [build_executable "failed to prepare" $testfile $srcfile \
          [list debug shlib=$libipa]] } {
     return -1
 }
 
+save_vars { env(ASAN_OPTIONS) } {
+    # Prevent address sanitizer error:
+    # 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
+
+    clean_restart $binfile
+}
+
 if {![runto_main]} {
     return -1
 }