[gdb/testsuite] Remove unused globals
[deliverable/binutils-gdb.git] / gdb / testsuite / lib / prompt.exp
1 # Copyright (C) 2011-2020 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 # Specialized subroutines for launching gdb and testing the very first prompt.
17
18
19 #
20 # start gdb -- start gdb running, prompt procedure
21 # this procedure differs from the default in that you must pass 'set height 0',
22 # and 'set width 0', yourself in GDBFLAGS, and it has a gdb_prompt_fail variable,
23 #
24 # uses pass if it sees $gdb_prompt, and fail if it sees $gdb_prompt_fail.
25 #
26 proc default_prompt_gdb_start { } {
27 global GDB
28 global INTERNAL_GDBFLAGS GDBFLAGS
29 global gdb_prompt
30 global gdb_prompt_fail
31 global timeout
32 global gdb_spawn_id
33
34 gdb_stop_suppressing_tests
35
36 verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
37
38 if [info exists gdb_spawn_id] {
39 return 0
40 }
41
42 if ![is_remote host] {
43 if { [which $GDB] == 0 } then {
44 perror "$GDB does not exist."
45 exit 1
46 }
47 }
48 set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]"]
49 if { $res < 0 || $res == "" } {
50 perror "Spawning $GDB failed."
51 return 1
52 }
53 gdb_expect 360 {
54 -re ".*$gdb_prompt_fail.*$gdb_prompt_fail.*" {
55 fail "double prompted fail prompt"
56 }
57 -re ".*$gdb_prompt.*$gdb_prompt.*" {
58 fail "double prompted"
59 }
60 -re "\[\r\n\]$gdb_prompt_fail $" {
61 fail "GDB initializing first prompt"
62 }
63 -re "\[\r\n\]$gdb_prompt $" {
64 pass "GDB initializing first prompt"
65 }
66 -re "$gdb_prompt $" {
67 perror "GDB never initialized."
68 return -1
69 }
70 -re "$gdb_prompt_fail $" {
71 perror "GDB never initialized."
72 return -1
73 }
74 timeout {
75 perror "(timeout) GDB never initialized after 10 seconds."
76 remote_close host
77 return -1
78 }
79 }
80 set gdb_spawn_id $res
81 return 0
82 }
83
84 #
85 # Overridable function. You can override this function in your
86 # baseboard file.
87 #
88 proc prompt_gdb_start { } {
89 default_prompt_gdb_start
90 }
91
This page took 0.039095 seconds and 5 git commands to generate.