1 # Copyright 2011-2015 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$ cd ${build_dir}/gdb
21 # bash$ make check RUNTESTFLAGS="--target_board=native-extended-gdbserver"
23 load_generic_config "extended-gdbserver"
24 load_board_description "gdbserver-base"
26 # By default, dejagnu makes the board remote unless the board name
27 # matches localhost. Force it to be NOT remote.
30 # Remove any target variant specifications from the name.
31 set baseboard [lindex [split $board "/"] 0]
32 set board_info($baseboard,isremote) 0
34 set_board_info sockethost "localhost:"
36 # We will be using the extended GDB remote protocol.
37 set_board_info gdb_protocol "extended-remote"
39 send_user "configuring for gdbserver local testing (extended-remote)\n"
41 # We must load this explicitly here, and rename the procedures we want
42 # to override. If we didn't do this, given that mi-support.exp is
43 # loaded later in the test files, the procedures loaded then would
44 # override our definitions.
45 load_lib mi-support.exp
47 # Overriden in order to start a "gdbserver --multi" instance whenever
48 # GDB is started. Note nothing is needed for gdb_exit, since
49 # gdbserver is started with --once, causing it to exit once GDB
55 # And then GDBserver, ready for extended-remote mode.
63 if { [info procs extended_gdbserver_mi_gdb_start] == "" } {
64 rename mi_gdb_start extended_gdbserver_mi_gdb_start
66 proc mi_gdb_start { args } {
67 global gdbserver_reconnect_p
70 set res [extended_gdbserver_mi_gdb_start $args]
75 # And then spawn GDBserver and connect to it in extended-remote
76 # mode, unless the test wants to explicitly test reconnection.
77 if {![info exists gdbserver_reconnect_p] || !$gdbserver_reconnect_p} {
78 mi_gdbserver_start_multi
83 # Overriden in order to set the remote exec-file whenever a file is
86 proc gdb_load { arg } {
88 global last_loaded_file
91 if [gdb_file_cmd $arg] then { return -1 }
94 send_gdb "set remote exec-file $last_loaded_file\n"
96 -re "$gdb_prompt $" {}
98 perror "couldn't set the remote exec-file (timed out)."
108 if { [info procs extended_gdbserver_mi_gdb_load] == "" } {
109 rename mi_gdb_load extended_gdbserver_mi_gdb_load
111 proc mi_gdb_load { arg } {
114 set res [extended_gdbserver_mi_gdb_load $arg]
115 if { $res } then { return -1 }
117 send_gdb "100-gdb-set remote exec-file $arg\n"
119 -re ".*100-gdb-set remote exec-file $arg\r\n100\\\^done\r\n$mi_gdb_prompt$" {
120 verbose "set the remote exec-file to $arg."
123 perror "couldn't set the remote exec-file (timed out)."