1 # Copyright
2011-2021 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"
25 load_board_description
"local-board"
27 # We will be using the extended GDB remote protocol.
28 set_board_info gdb_protocol
"extended-remote"
30 send_user
"configuring for gdbserver local testing (extended-remote)\n"
32 # We must
load this explicitly here
, and
rename the procedures we want
33 # to override.
If we didn
't do this, given that mi-support.exp is
34 # loaded later in the test files, the procedures loaded then would
35 # override our definitions.
36 load_lib mi-support.exp
38 # Overriden in order to start a "gdbserver --multi" instance whenever
39 # GDB is started. Note nothing is needed for gdb_exit, since
40 # gdbserver is started with --once, causing it to exit once GDB
46 # And then GDBserver, ready for extended-remote mode.
54 if { [info procs extended_gdbserver_mi_gdb_start] == "" } {
55 rename mi_gdb_start extended_gdbserver_mi_gdb_start
57 proc mi_gdb_start { args } {
58 global gdbserver_reconnect_p
61 set res [extended_gdbserver_mi_gdb_start $args]
66 # And then spawn GDBserver and connect to it in extended-remote
67 # mode, unless the test wants to explicitly test reconnection.
68 if {![info exists gdbserver_reconnect_p] || !$gdbserver_reconnect_p} {
69 mi_gdbserver_start_multi
74 # Helper that runs "set remote exec-file" with the last loaded file.
76 proc extended_gdbserver_load_last_file {} {
78 global last_loaded_file
80 send_gdb "set remote exec-file $last_loaded_file\n"
82 -re "$gdb_prompt $" {}
84 perror "couldn't
set the remote exec
-file
(timed out
).
"
92 # Overriden in order to
set the remote exec
-file whenever a file is
95 if { [info procs extended_gdbserver_gdb_file_cmd
] == "" } {
96 rename gdb_file_cmd extended_gdbserver_gdb_file_cmd
98 proc gdb_file_cmd
{ arg } {
99 if [extended_gdbserver_gdb_file_cmd $
arg] {
102 return [extended_gdbserver_load_last_file
]
105 proc gdb_reload
{ {inferior_args
{}} } {
106 return [extended_gdbserver_load_last_file
]
109 # With the two procedure overrides above
, it shouldn
't be necessary to
110 # override this one too. However, not doing so regresses
111 # gdb.base/dbx.exp. See comments above gdb.base/dbx.exp:gdb_file_cmd.
112 # Once testing of the "symbol-file"/"exec-file" commands is moved out
113 # to a separate non-dbx testcase, we should be able to remove this.
114 proc gdb_load { arg } {
116 if [gdb_file_cmd $arg] then { return -1 }
119 return [extended_gdbserver_load_last_file]
125 if { [info procs extended_gdbserver_mi_gdb_load] == "" } {
126 rename mi_gdb_load extended_gdbserver_mi_gdb_load
128 proc mi_gdb_load { arg } {
131 set res [extended_gdbserver_mi_gdb_load $arg]
132 if { $res } then { return -1 }
134 send_gdb "100-gdb-set remote exec-file $arg\n"
136 -re ".*100-gdb-set remote exec-file $arg\r\n100\\\^done\r\n$mi_gdb_prompt$" {
137 verbose "set the remote exec-file to $arg."
140 perror "couldn't
set the remote exec
-file
(timed out
).
"