f842c445d246dfccee10467fed124e49c1e2f57b
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.server / non-existing-program.exp
1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 2015 Free Software Foundation, Inc.
4
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.
9 #
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.
14 #
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/>.
17
18 # Test starting gdbserver passing it the name of a non-existing
19 # program.
20
21 load_lib gdbserver-support.exp
22
23 standard_testfile
24
25 if { [skip_gdbserver_tests] } {
26 return 0
27 }
28
29 set gdbserver [find_gdbserver]
30 if { $gdbserver == "" } {
31 fail "could not find gdbserver"
32 return
33 }
34
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"]
38
39 set msg "gdbserver exits cleanly"
40 set saw_exiting 0
41 expect {
42 # This is what we get on ptrace-based targets.
43 -re "stdin/stdout redirected.*No program to debug\r\nExiting\r\n$" {
44 set saw_exiting 1
45 exp_continue
46 }
47 # This is what we get on Windows.
48 -re "Error creating process\r\n\r\nExiting\r\n$" {
49 set saw_exiting 1
50 exp_continue
51 }
52 -re "A problem internal to GDBserver has been detected" {
53 fail "$msg (GDBserver internal error)"
54 wait
55 }
56 eof {
57 gdb_assert $saw_exiting $msg
58 wait
59 }
60 timeout {
61 fail "$msg (timeout)"
62 }
63 }
This page took 0.030848 seconds and 3 git commands to generate.