1 # Copyright (C) 2011-2020 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 # Specialized subroutines for launching gdb and testing the very first prompt.
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,
24 # uses pass if it sees $gdb_prompt, and fail if it sees $gdb_prompt_fail.
26 proc default_prompt_gdb_start { } {
28 global INTERNAL_GDBFLAGS GDBFLAGS
30 global gdb_prompt_fail
34 gdb_stop_suppressing_tests
36 verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
38 if [info exists gdb_spawn_id] {
42 if ![is_remote host] {
43 if { [which $GDB] == 0 } then {
44 perror "$GDB does not exist."
48 set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]"]
49 if { $res < 0 || $res == "" } {
50 perror "Spawning $GDB failed."
54 -re ".*$gdb_prompt_fail.*$gdb_prompt_fail.*" {
55 fail "double prompted fail prompt"
57 -re ".*$gdb_prompt.*$gdb_prompt.*" {
58 fail "double prompted"
60 -re "\[\r\n\]$gdb_prompt_fail $" {
61 fail "GDB initializing first prompt"
63 -re "\[\r\n\]$gdb_prompt $" {
64 pass "GDB initializing first prompt"
67 perror "GDB never initialized."
70 -re "$gdb_prompt_fail $" {
71 perror "GDB never initialized."
75 perror "(timeout) GDB never initialized after 10 seconds."
85 # Overridable function. You can override this function in your
88 proc prompt_gdb_start { } {
89 default_prompt_gdb_start