mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
[gdb/testsuite] Run two test-cases with ASAN_OPTIONS=verify_asan_link_order=0
When building gdb with -fsanitize=address we run into: ... builtin_spawn gdb -nw -nx -iex set height 0 -iex set width 0 -data-directory \ build/gdb/data-directory^M ==10637==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 ERROR: GDB process no longer exists ... Prevent the ASan runtime error by using ASAN_OPTIONS=verify_asan_link_order=0. This makes both test-cases pass. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29358
This commit is contained in:
@ -33,7 +33,7 @@ if { [is_remote host] } {
|
|||||||
proc gdb_spawn_with_ld_preload {lib cmdline_opts} {
|
proc gdb_spawn_with_ld_preload {lib cmdline_opts} {
|
||||||
global env
|
global env
|
||||||
|
|
||||||
save_vars { env(LD_PRELOAD) } {
|
save_vars { env(LD_PRELOAD) env(ASAN_OPTIONS)} {
|
||||||
if { ![info exists env(LD_PRELOAD) ]
|
if { ![info exists env(LD_PRELOAD) ]
|
||||||
|| $env(LD_PRELOAD) == "" } {
|
|| $env(LD_PRELOAD) == "" } {
|
||||||
set env(LD_PRELOAD) "$lib"
|
set env(LD_PRELOAD) "$lib"
|
||||||
@ -41,6 +41,12 @@ proc gdb_spawn_with_ld_preload {lib cmdline_opts} {
|
|||||||
append env(LD_PRELOAD) ":$lib"
|
append env(LD_PRELOAD) ":$lib"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
gdb_spawn_with_cmdline_opts $cmdline_opts
|
gdb_spawn_with_cmdline_opts $cmdline_opts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ with_test_prefix "compile test executable" {
|
|||||||
proc gdb_spawn_with_ld_preload {lib} {
|
proc gdb_spawn_with_ld_preload {lib} {
|
||||||
global env
|
global env
|
||||||
|
|
||||||
save_vars { env(LD_PRELOAD) } {
|
save_vars { env(LD_PRELOAD) env(ASAN_OPTIONS) } {
|
||||||
if { ![info exists env(LD_PRELOAD) ]
|
if { ![info exists env(LD_PRELOAD) ]
|
||||||
|| $env(LD_PRELOAD) == "" } {
|
|| $env(LD_PRELOAD) == "" } {
|
||||||
set env(LD_PRELOAD) "$lib"
|
set env(LD_PRELOAD) "$lib"
|
||||||
@ -79,6 +79,12 @@ proc gdb_spawn_with_ld_preload {lib} {
|
|||||||
append env(LD_PRELOAD) ":$lib"
|
append env(LD_PRELOAD) ":$lib"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
gdb_start
|
gdb_start
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user