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 { } {
29 global INTERNAL_GDBFLAGS GDBFLAGS
31 global gdb_prompt_fail
35 gdb_stop_suppressing_tests
37 verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
39 if [info exists gdb_spawn_id] {
43 if ![is_remote host] {
44 if { [which $GDB] == 0 } then {
45 perror "$GDB does not exist."
49 set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]"]
50 if { $res < 0 || $res == "" } {
51 perror "Spawning $GDB failed."
55 -re ".*$gdb_prompt_fail.*$gdb_prompt_fail.*" {
56 fail "double prompted fail prompt"
58 -re ".*$gdb_prompt.*$gdb_prompt.*" {
59 fail "double prompted"
61 -re "\[\r\n\]$gdb_prompt_fail $" {
62 fail "GDB initializing first prompt"
64 -re "\[\r\n\]$gdb_prompt $" {
65 pass "GDB initializing first prompt"
68 perror "GDB never initialized."
71 -re "$gdb_prompt_fail $" {
72 perror "GDB never initialized."
76 perror "(timeout) GDB never initialized after 10 seconds."
86 # Overridable function. You can override this function in your
89 proc prompt_gdb_start { } {
90 default_prompt_gdb_start