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