1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2015-2019 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test starting gdbserver passing it the name of a non-existing
21 load_lib gdbserver-support.exp
25 if { [skip_gdbserver_tests] } {
29 set gdbserver [find_gdbserver]
30 if { $gdbserver == "" } {
31 fail "could not find gdbserver"
35 # Fire off gdbserver. The port doesn't really matter, gdbserver tries
36 # to spawn the program before opening the connection.
37 set spawn_id [remote_spawn target "$gdbserver stdio non-existing-program"]
39 set msg "gdbserver exits cleanly"
42 # This is what we get on ptrace-based targets with
43 # startup-with-shell disabled (e.g., when the SHELL variable is
45 -re "stdin/stdout redirected.*gdbserver: Cannot exec non-existing-program\r\ngdbserver: Error: No such file or directory\r\n\r\nDuring startup program exited with code 127\.\r\nExiting\r\n$" {
49 # Likewise, but with startup-with-shell enabled, which is the
51 -re "stdin/stdout redirected.*exec: non-existing-program: not found\r\nDuring startup program exited with code 127\.\r\nExiting\r\n$" {
55 # This is what we get on Windows.
56 -re "Error creating process\r\n\r\nExiting\r\n$" {
60 -re "A problem internal to GDBserver has been detected" {
61 fail "$msg (GDBserver internal error)"
65 gdb_assert $saw_exiting $msg
73 # expect defaults to spawn_id in many places. Avoid confusing any