Commit | Line | Data |
---|---|---|
19fa4a0a MW |
1 | # Test Framework Driver |
2 | # Copyright (C) 1988, 1990, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, 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 | # these need to be initialized only if site.exp doesn't set them | |
24 | if ![info exists prompt] then { | |
25 | set prompt "\(gdb\)" | |
26 | } | |
27 | ||
28 | # | |
29 | # gdb_version -- extract and print the version number of gdb | |
30 | # | |
31 | proc gdb_version {} { | |
32 | global GDB | |
33 | global GDBFLAGS | |
34 | global prompt | |
35 | set tmp [exec echo "q" | $GDB] | |
36 | set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]] | |
37 | set version [string range $version 0 [expr [string length $version]-2]] | |
38 | clone_output "[which $GDB] version $version $GDBFLAGS\n" | |
39 | } | |
40 | ||
41 | # | |
42 | # gdb_load -- load a file into the debugger. | |
43 | # | |
44 | proc gdb_load { arg } { | |
45 | global verbose | |
46 | global loadpath | |
47 | global loadfile | |
48 | global prompt | |
49 | global GDB | |
50 | set loadfile [file tail $arg] | |
51 | set loadpath [file dirname $arg] | |
52 | send_user "Not implememted yet\n" ; alldone | |
53 | } | |
54 | ||
55 | # | |
56 | # gdb_exit -- exit the debugger | |
57 | # | |
58 | proc gdb_exit {} { | |
59 | global GDB | |
60 | global GDBFLAGS | |
61 | global verbose | |
62 | send "quit\n" | |
63 | expect { | |
64 | eof { | |
65 | if $verbose>1 then { | |
66 | send_user "Got EOF from $GDB\n" | |
67 | } | |
68 | } | |
69 | timeout { | |
70 | if $verbose>1 then { | |
71 | send_user "Got TIMEOUT from $GDB\n" | |
72 | } | |
73 | } | |
74 | -re "The program is running. Quit anyway? (y or n) $"\ | |
75 | { send "y\n" | |
76 | if $verbose>1 then { | |
77 | send_user "\t\tKilling program being debugged\n" | |
78 | } | |
79 | } | |
80 | } | |
81 | if $verbose>1 then { | |
82 | send_user "Quitting $GDB $GDBFLAGS\n" | |
83 | } | |
84 | } | |
85 | ||
86 | # | |
87 | # gdb_start -- start GDB running | |
88 | # | |
89 | proc gdb_start { } { | |
90 | global GDB | |
91 | global GDBFLAGS | |
92 | global spawn_id | |
93 | global prompt | |
94 | global verbose | |
95 | global targetname | |
96 | send_user "Not implememted yet\n" ; alldone | |
97 | } | |
98 | ||
99 | expect_after { | |
100 | "<return>" { send "\n"; clone_output "ERROR: Window too small" } | |
101 | -re "\(y or n\) " { send "n\n"; clone_output "ERROR: Got interactive prompt" } | |
102 | buffer_full { clone_output "ERROR: internal buffer is full" } | |
103 | eof { clone_output "ERROR: eof -- pty is hosed" } | |
104 | timeout { clone_output "ERROR: timeout" } | |
105 | "virtual memory exhausted" { clone_output "ERROR: virtual memory exhausted" } | |
106 | "Undefined command" { clone_output "ERROR: send string probably wrong" } | |
107 | } | |
108 | ||
109 | load_lib gdb.exp | |
110 | ||
111 | gdb_start | |
112 | ||
113 | # make sure gdb has actually started, otherwise if the first test | |
114 | # timesout, DejaGnu crashes | |
115 | send "\n" | |
116 | expect { | |
117 | -re "$prompt" | |
118 | } |