diff options
author | Pedro Alves <palves@redhat.com> | 2017-10-13 01:27:18 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-10-13 01:27:18 +0100 |
commit | f5ca00321dd8da526b8a6a894465bdc7a14d30ac (patch) | |
tree | 90d197fdc4601674f39d972a69fe3a93eb190b54 /gdb/testsuite/boards | |
parent | 52a58c224d5d45cc6d7749e2d93827c218562a30 (diff) |
Eliminate is_remote check in gdb.base/scope.exp
This commit makes --target_board=native-gdbserver (and in principle
all other is_remote boards) pass all the same gdb.base/scope.exp tests
as native testing.
I first wrote the gdb.base/scope.exp change described in the ChangeLog
below and in the new comments in the patch, knowing that gdb_file_cmd
was the right thing to use here.
However, that revealed that the native-extended-gdbserver board should
be overriding gdb_file_cmd+gdb_reload instead of gdb_load, as is
hinted at by the comments on top of the default implementations in
testsuite/lib/gdb.exp, because otherwise a gdb_run_cmd after
gdb_file_cmd misses setting "set remote exec-file". However, if we do
that and remove gdb_load, then we regress gdb.base/dbx.exp, so for now
keep the gdb_load override as well.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/scope.exp: Use build_executable + clean_restart +
gdb_file_cmd instead of prepare_for_testing and no longer skip
"before run" tests on is_remote target boards. Update comments.
* boards/native-extended-gdbserver.exp
(extended_gdbserver_load_last_file): New, factored out from ...
(gdb_load): ... this. Move further below and add comment.
(extended_gdbserver_gdb_file_cmd, gdb_file_cmd, gdb_reload): New.
Diffstat (limited to 'gdb/testsuite/boards')
-rw-r--r-- | gdb/testsuite/boards/native-extended-gdbserver.exp | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp index 4ea210f095..564ffd2229 100644 --- a/gdb/testsuite/boards/native-extended-gdbserver.exp +++ b/gdb/testsuite/boards/native-extended-gdbserver.exp @@ -80,17 +80,12 @@ proc mi_gdb_start { args } { return 0 } -# Overriden in order to set the remote exec-file whenever a file is -# loaded to gdb. -# -proc gdb_load { arg } { +# Helper that runs "set remote exec-file" with the last loaded file. + +proc extended_gdbserver_load_last_file {} { global gdb_prompt global last_loaded_file - if { $arg != "" } { - if [gdb_file_cmd $arg] then { return -1 } - } - send_gdb "set remote exec-file $last_loaded_file\n" gdb_expect { -re "$gdb_prompt $" {} @@ -103,6 +98,37 @@ proc gdb_load { arg } { return 0 } +# Overriden in order to set the remote exec-file whenever a file is +# loaded to gdb. +# +if { [info procs extended_gdbserver_gdb_file_cmd] == "" } { + rename gdb_file_cmd extended_gdbserver_gdb_file_cmd +} +proc gdb_file_cmd { arg } { + if [extended_gdbserver_gdb_file_cmd $arg] { + return -1 + } + return [extended_gdbserver_load_last_file] +} + +proc gdb_reload { } { + return [extended_gdbserver_load_last_file] +} + +# With the two procedure overrides above, it shouldn't be necessary to +# override this one too. However, not doing so regresses +# gdb.base/dbx.exp. See comments above gdb.base/dbx.exp:gdb_file_cmd. +# Once testing of the "symbol-file"/"exec-file" commands is moved out +# to a separate non-dbx testcase, we should be able to remove this. +proc gdb_load { arg } { + if { $arg != "" } { + if [gdb_file_cmd $arg] then { return -1 } + } + + return [extended_gdbserver_load_last_file] +} + + # Likewise, for MI. # if { [info procs extended_gdbserver_mi_gdb_load] == "" } { |