diff options
author | Tom de Vries <tdevries@suse.de> | 2023-03-13 17:20:09 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-03-13 17:20:09 +0100 |
commit | ed7d5797b56e8b771d5f7553738f790819d96b6f (patch) | |
tree | 9abe25130b8e931a3fd042c6fef42aaa21bb9a85 | |
parent | 275589d9a0fda6fe898aae678588bb3841d3fed1 (diff) | |
download | binutils-ed7d5797b56e8b771d5f7553738f790819d96b6f.zip binutils-ed7d5797b56e8b771d5f7553738f790819d96b6f.tar.gz binutils-ed7d5797b56e8b771d5f7553738f790819d96b6f.tar.bz2 |
[gdb/testsuite] Fix untested message in gdb.tui/corefile-run.exp
In test-case gdb.tui/corefile-run.exp, we have this bit:
...
require !use_gdb_stub
if { [target_info gdb_protocol] == "extended-remote" } {
untested "not supported"
return
}
...
So with target board native-gdbserver we get:
...
UNSUPPORTED: gdb.tui/corefile-run.exp: require failed: !use_gdb_stub
...
and with target board native-extended-gdbserver instead:
...
UNTESTED: gdb.tui/corefile-run.exp: not supported
...
Fix this by:
- adding an optional argument target_description to proc
target_can_use_run_cmd
- handling the target_description == core &&
[target_info gdb_protocol] == "extended-remote" case in the proc
- using require {target_can_use_run_cmd core}
such that now in both cases we have:
...
UNSUPPORTED: gdb.tui/corefile-run.exp: require failed: \
target_can_use_run_cmd core
...
Tested on x86_64-linux.
-rw-r--r-- | gdb/testsuite/gdb.tui/corefile-run.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 22 |
2 files changed, 22 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp index 02606ee..2109a0a 100644 --- a/gdb/testsuite/gdb.tui/corefile-run.exp +++ b/gdb/testsuite/gdb.tui/corefile-run.exp @@ -29,11 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { } # Only run on native boards. -require !use_gdb_stub -if { [target_info gdb_protocol] == "extended-remote" } { - untested "not supported" - return -} +require {target_can_use_run_cmd core} if { ![runto_main] } { return -1 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e2b08c6..23277c4 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -385,13 +385,33 @@ proc delete_breakpoints {} { # Returns true iff the target supports using the "run" command. -proc target_can_use_run_cmd {} { +proc target_can_use_run_cmd { {target_description ""} } { + if { $target_description == "" } { + set have_core 0 + } elseif { $target_description == "core" } { + # We could try to figure this out by issuing an "info target" and + # checking for "Local core dump file:", but it would mean the proc + # would start requiring a current target. Also, uses while gdb + # produces non-standard output due to, say annotations would + # have to be moved around or eliminated, which would further limit + # usability. + set have_core 1 + } else { + error "invalid argument: $target_description" + } + if [target_info exists use_gdb_stub] { # In this case, when we connect, the inferior is already # running. return 0 } + if { $have_core && [target_info gdb_protocol] == "extended-remote" } { + # In this case, when we connect, the inferior is not running but + # cannot be made to run. + return 0 + } + # Assume yes. return 1 } |