1 # Copyright 2011-2013 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file is a dejagnu "board file" and is used to run the testsuite
17 # natively with gdbserver, in extended-remote mode.
20 # bash$ touch ${my_dejagnu_dir}/my-dejagnu.exp
21 # bash$ export DEJAGNU=${my_dejagnu_dir}/my-dejagnu.exp
22 # bash$ mkdir ${my_dejagnu_dir}/boards
23 # bash$ cp ${src_dir}/gdb/testsuite/boards/native-extended-gdbserver.exp \
24 # ${my_dejagnu_dir}/boards
25 # bash$ cd ${build_dir}/gdb
26 # bash$ make check RUNTESTFLAGS="--target_board=native-extended-gdbserver"
28 load_generic_config "extended-gdbserver"
30 # By default, dejagnu makes the board remote unless the board name
31 # matches localhost. Force it to be NOT remote.
34 set board_info($board,isremote) 0
36 process_multilib_options ""
38 # The default compiler for this target.
39 set_board_info compiler "[find_gcc]"
41 # Can't do input (or output) in the current gdbserver.
42 set_board_info gdb,noinferiorio 1
44 # gdbserver does not intercept target file operations and perform them
46 set_board_info gdb,nofileio 1
48 set_board_info sockethost "localhost:"
50 # We will be using the extended GDB remote protocol.
51 set_board_info gdb_protocol "extended-remote"
53 # Test the copy of gdbserver in the build directory.
54 set_board_info gdb_server_prog "../gdbserver/gdbserver"
56 send_user "configuring for gdbserver local testing (extended-remote)\n";
58 # We must load this explicitly here, and rename the procedures we want
59 # to override. If we didn't do this, given that mi-support.exp is
60 # loaded later in the test files, the procedures loaded then would
61 # override our definitions.
62 load_lib mi-support.exp
64 # Overriden in order to start a "gdbserver --multi" instance whenever
65 # GDB is started. Note nothing is needed for gdb_exit, since
66 # gdbserver is started with --once, causing it to exit once GDB
72 # And then GDBserver, ready for extended-remote mode.
80 if { [info procs extended_gdbserver_mi_gdb_start] == "" } {
81 rename mi_gdb_start extended_gdbserver_mi_gdb_start
83 proc mi_gdb_start { args } {
85 set res [extended_gdbserver_mi_gdb_start $args]
90 # And then GDBserver, ready for extended-remote mode.
91 mi_gdbserver_start_multi
95 # Overriden in order to set the remote exec-file whenever a file is
98 proc gdb_load { arg } {
102 if [gdb_file_cmd $arg] then { return -1 }
105 send_gdb "set remote exec-file $arg\n"
107 -re "$gdb_prompt $" {}
109 perror "couldn't set the remote exec-file (timed out)."
119 if { [info procs extended_gdbserver_mi_gdb_load] == "" } {
120 rename mi_gdb_load extended_gdbserver_mi_gdb_load
122 proc mi_gdb_load { arg } {
125 set res [extended_gdbserver_mi_gdb_load $arg]
126 if { $res } then { return -1 }
128 send_gdb "100-gdb-set remote exec-file $arg\n"
130 -re ".*100-gdb-set remote exec-file $arg\r\n100\\\^done\r\n$mi_gdb_prompt$" {
131 verbose "set the remote exec-file to $arg."
134 perror "couldn't set the remote exec-file (timed out)."
141 proc ${board}_download { board host dest } {
145 proc ${board}_file { dest op args } {
146 if { $op == "delete" } {
149 return [eval [list standard_file $dest $op] $args]