* elf64-ppc.c (dec_dynrel_count): Don't error when elf_gc_sweep_symbol
[external/binutils.git] / gdb / testsuite / boards / native-extended-gdbserver.exp
1 # Copyright 2011-2013 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
15
16 # This file is a dejagnu "board file" and is used to run the testsuite
17 # natively with gdbserver, in extended-remote mode.
18 #
19 # To use this file:
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"
27
28 load_generic_config "extended-gdbserver"
29
30 # By default, dejagnu makes the board remote unless the board name
31 # matches localhost.  Force it to be NOT remote.
32 global board
33 global board_info
34 set board_info($board,isremote) 0
35
36 process_multilib_options ""
37
38 # The default compiler for this target.
39 set_board_info compiler "[find_gcc]"
40
41 # Can't do input (or output) in the current gdbserver.
42 set_board_info gdb,noinferiorio 1
43
44 # gdbserver does not intercept target file operations and perform them
45 # on the host.
46 set_board_info gdb,nofileio 1
47
48 set_board_info sockethost "localhost:"
49
50 # We will be using the extended GDB remote protocol.
51 set_board_info gdb_protocol "extended-remote"
52
53 # Test the copy of gdbserver in the build directory.
54 set_board_info gdb_server_prog "../gdbserver/gdbserver"
55
56 send_user "configuring for gdbserver local testing (extended-remote)\n";
57
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
63
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
67 # disconnects.
68 proc gdb_start { } {
69     # Spawn GDB.
70     default_gdb_start
71
72     # And then GDBserver, ready for extended-remote mode.
73     gdbserver_start_multi
74
75     return 0
76 }
77
78 # Likewise, for MI.
79 #
80 if { [info procs extended_gdbserver_mi_gdb_start] == "" } {
81     rename mi_gdb_start extended_gdbserver_mi_gdb_start
82 }
83 proc mi_gdb_start { args } {
84     # Spawn GDB.
85     set res [extended_gdbserver_mi_gdb_start $args]
86     if { $res } {
87         return $res
88     }
89
90     # And then GDBserver, ready for extended-remote mode.
91     mi_gdbserver_start_multi
92     return 0
93 }
94
95 # Overriden in order to set the remote exec-file whenever a file is
96 # loaded to gdb.
97 #
98 proc gdb_load { arg } {
99     global gdb_prompt
100
101     if { $arg != "" } {
102         if [gdb_file_cmd $arg] then { return -1 }
103     }
104
105     send_gdb "set remote exec-file $arg\n"
106     gdb_expect {
107         -re "$gdb_prompt $" {}
108         timeout {
109             perror "couldn't set the remote exec-file (timed out)."
110             return -1
111         }
112     }
113
114     return 0
115 }
116
117 # Likewise, for MI.
118 #
119 if { [info procs extended_gdbserver_mi_gdb_load] == "" } {
120     rename mi_gdb_load extended_gdbserver_mi_gdb_load
121 }
122 proc mi_gdb_load { arg } {
123     global mi_gdb_prompt
124
125     set res [extended_gdbserver_mi_gdb_load $arg]
126     if { $res } then { return -1 }
127
128     send_gdb "100-gdb-set remote exec-file $arg\n"
129     gdb_expect 10 {
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."
132         }
133         timeout {
134             perror "couldn't set the remote exec-file (timed out)."
135         }
136     }
137
138     return 0
139 }
140
141 proc ${board}_download { board host dest } {
142     return $host
143 }
144
145 proc ${board}_file { dest op args } {
146     if { $op == "delete" } {
147         return 0
148     }
149     return [eval [list standard_file $dest $op] $args]
150 }