forked from Imagelibrary/binutils-gdb
Fix test suite failure in file-then-restart.exp
Simon pointed out that the new file-then-restart.exp test fails with the extended-remote target board. The problem is that the test suite doesn't use gdb_file_cmd -- which handles things like "set remote exec-file". This patch changes gdb_file_cmd to make the "kill" command optional, and then switches the test case to use it. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30933 Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@@ -95,8 +95,8 @@ proc extended_gdbserver_load_last_file {} {
|
|||||||
if { [info procs extended_gdbserver_gdb_file_cmd] == "" } {
|
if { [info procs extended_gdbserver_gdb_file_cmd] == "" } {
|
||||||
rename gdb_file_cmd extended_gdbserver_gdb_file_cmd
|
rename gdb_file_cmd extended_gdbserver_gdb_file_cmd
|
||||||
}
|
}
|
||||||
proc gdb_file_cmd { arg } {
|
proc gdb_file_cmd { arg {kill_flag 1} } {
|
||||||
if [extended_gdbserver_gdb_file_cmd $arg] {
|
if [extended_gdbserver_gdb_file_cmd $arg $kill_flag] {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
return [extended_gdbserver_load_last_file]
|
return [extended_gdbserver_load_last_file]
|
||||||
|
|||||||
@@ -50,12 +50,8 @@ foreach_with_prefix scenario {kill no-kill} {
|
|||||||
|
|
||||||
gdb_test_no_output "set confirm off"
|
gdb_test_no_output "set confirm off"
|
||||||
|
|
||||||
if {$scenario == "kill"} {
|
set result [gdb_file_cmd $binfile2 [expr {$scenario == "kill"}]]
|
||||||
gdb_test "kill" "Inferior $decimal .*killed.*"
|
gdb_assert {$result == 0} "switch to second executable"
|
||||||
}
|
|
||||||
|
|
||||||
gdb_test "file $binfile2" "Reading symbols from .*" \
|
|
||||||
"switch to second executable"
|
|
||||||
|
|
||||||
# Start the program a second time, GDB should land in procedure
|
# Start the program a second time, GDB should land in procedure
|
||||||
# Second this time.
|
# Second this time.
|
||||||
|
|||||||
@@ -2146,6 +2146,9 @@ proc default_gdb_exit {} {
|
|||||||
# Load a file into the debugger.
|
# Load a file into the debugger.
|
||||||
# The return value is 0 for success, -1 for failure.
|
# The return value is 0 for success, -1 for failure.
|
||||||
#
|
#
|
||||||
|
# ARG is the file name.
|
||||||
|
# KILL_FLAG, if given, indicates whether a "kill" command should be used.
|
||||||
|
#
|
||||||
# This procedure also set the global variable GDB_FILE_CMD_DEBUG_INFO
|
# This procedure also set the global variable GDB_FILE_CMD_DEBUG_INFO
|
||||||
# to one of these values:
|
# to one of these values:
|
||||||
#
|
#
|
||||||
@@ -2165,7 +2168,7 @@ proc default_gdb_exit {} {
|
|||||||
# TODO: gdb.base/sepdebug.exp and gdb.stabs/weird.exp might be able to use
|
# TODO: gdb.base/sepdebug.exp and gdb.stabs/weird.exp might be able to use
|
||||||
# this if they can get more information set.
|
# this if they can get more information set.
|
||||||
|
|
||||||
proc gdb_file_cmd { arg } {
|
proc gdb_file_cmd { arg {kill_flag 1} } {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
global GDB
|
global GDB
|
||||||
global last_loaded_file
|
global last_loaded_file
|
||||||
@@ -2194,6 +2197,7 @@ proc gdb_file_cmd { arg } {
|
|||||||
# The file command used to kill the remote target. For the benefit
|
# The file command used to kill the remote target. For the benefit
|
||||||
# of the testsuite, preserve this behavior. Mark as optional so it doesn't
|
# of the testsuite, preserve this behavior. Mark as optional so it doesn't
|
||||||
# get written to the stdin log.
|
# get written to the stdin log.
|
||||||
|
if {$kill_flag} {
|
||||||
send_gdb "kill\n" optional
|
send_gdb "kill\n" optional
|
||||||
gdb_expect 120 {
|
gdb_expect 120 {
|
||||||
-re "Kill the program being debugged. .y or n. $" {
|
-re "Kill the program being debugged. .y or n. $" {
|
||||||
@@ -2205,6 +2209,7 @@ proc gdb_file_cmd { arg } {
|
|||||||
# OK.
|
# OK.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
send_gdb "file $arg\n"
|
send_gdb "file $arg\n"
|
||||||
set new_symbol_table 0
|
set new_symbol_table 0
|
||||||
|
|||||||
Reference in New Issue
Block a user