diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5553782e0a..6138a18f78 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-02-06 Shahab Vahedi + + * lib/gdb.exp (gdb_wrapper_init): Reset + "gdb_wrapper_initialized" to 0 if "wrapper_file" does + not exist. + 2020-02-20 Tom de Vries PR go/17018 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index d8ebddf63c..81518b9646 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3577,11 +3577,20 @@ proc gdb_wrapper_init { args } { global gdb_wrapper_flags global gdb_wrapper_target + # If the wrapper is initialized but the wrapper file cannot be + # found anymore, the wrapper file must be built again. + if { $gdb_wrapper_initialized == 1 && \ + [info exists gdb_wrapper_file] && \ + ![file exists $gdb_wrapper_file] } { + verbose "reinitializing the wrapper" + set gdb_wrapper_initialized 0 + } + if { $gdb_wrapper_initialized == 1 } { return; } if {[target_info exists needs_status_wrapper] && \ [target_info needs_status_wrapper] != "0"} { - set result [build_wrapper "testglue.o"] + set result [build_wrapper [standard_output_file "testglue.o"]] if { $result != "" } { set gdb_wrapper_file [lindex $result 0] set gdb_wrapper_flags [lindex $result 1] @@ -3831,7 +3840,7 @@ proc gdb_compile {source dest type options} { verbose "options are $options" verbose "source is $source $dest $type $options" - if { $gdb_wrapper_initialized == 0 } { gdb_wrapper_init } + gdb_wrapper_init if {[target_info exists needs_status_wrapper] && \ [target_info needs_status_wrapper] != "0" && \