gdb/testsuite/
[deliverable/binutils-gdb.git] / gdb / testsuite / config / vx.exp
CommitLineData
28e7fd62 1# Copyright 1988-2013 Free Software Foundation, Inc.
c906108c
SS
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
16# This file was written by Rob Savoye. (rob@cygnus.com)
17
18#
19# load support libraries
20#
21load_lib remote.exp
22load_lib gdb.exp
23
24set shell_prompt "->"
25set gdb_prompt "\\(vxgdb\\)"
26
27#
28# gdb_version -- extract and print the version number of gcc
29#
30proc gdb_version {} {
31 default_gdb_version
32}
33
34#
35# gdb_load -- load a file into the debugger.
36# We have to stop and start gdb each time we do this, because when
37# vxgdb loads two files in a row, the symbols in the first file loaded
38# take precedence. Returns -1 on error, else 0.
39#
40proc gdb_load { arg } {
41 set result 0
42
43 if { [remote_ld target $arg] != 0 } {
44 perror "Couldn't load $arg"
45 return -1
46 }
47
48 return [gdb_file_cmd $arg]
49}
50
51#
52# gdb_start -- start gdb running
53#
54proc gdb_start { } {
55 global gdb_prompt
56 global verbose
57 global connectmode
58 global reboot
59
60 # get a connection to the board
13e4e967 61 for { set x 0 } { $x < 3 } { incr x } {
c906108c
SS
62 set shell_id [remote_open target]
63 if { $shell_id > 0 } {
64 verbose "Spawn id for remote shell is $shell_id"
65
66 set timeout 10
67 verbose "Timeout is now $timeout seconds" 2
68
69 set state [spawn_vxgdb];
70 if { $state == "pass" } {
ae59b1da 71 return 0
c906108c
SS
72 }
73 if { $state == "fail" } {
ae59b1da 74 return -1
c906108c
SS
75 }
76 }
77 remote_reboot target;
78 }
79}
80
81proc spawn_vxgdb { } {
82 global gdb_prompt
83
84 default_gdb_start
85
86 # set the default arguments to "main", so that "run" with no
87 # arguments will work correctly.
88 send_gdb "set args main\n"
89 gdb_expect -re ".*$gdb_prompt $" {}
90
91 verbose "Setting up target, Please wait..."
92 # set targets hostname
93 send_gdb "target vxworks [target_info hostname]\n"
94 set timeout 60
95 verbose "Timeout is now $timeout seconds" 2
96 gdb_expect {
97 -re "Done\..*$gdb_prompt $" {
98 verbose "Set target to [target_info hostname]" 1
99 set timeout 10;
ae59b1da 100 return "pass"
c906108c
SS
101 }
102 -re "net_connect: RPC: (Program not registered|.*Timed out).*$" {
103 warning "Couldn't set GDB to target [target_info netport]."
104 }
105 timeout {
106 warning "Couldn't set target for vxworks."
107 }
108 }
ae59b1da 109 return "retry"
c906108c
SS
110}
111
112proc gdb_exit { } {
113 remote_close target;
114 catch default_gdb_exit
115}
116
117#expect_after {
118# "<return>" { send "\n"; perror "Window too small." }
119# -re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." }
120# buffer_full { perror "internal buffer is full." }
121# eof { perror "eof -- pty is hosed." }
122# timeout { perror "timeout." }
123# "virtual memory exhausted" { perror "virtual memory exhausted." }
124# "Undefined command" { perror "send string probably wrong." }
125#}
126
This page took 1.250345 seconds and 4 git commands to generate.