Commit | Line | Data |
---|---|---|
19fa4a0a MW |
1 | # Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc. |
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 | |
5 | # the Free Software Foundation; either version 2 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
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. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program; if not, write to the Free Software | |
15 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
415e6208 | 18 | # bug-gdb@prep.ai.mit.edu |
19fa4a0a MW |
19 | |
20 | # This file was written by Rob Savoye. (rob@cygnus.com) | |
21 | ||
7e7cb02f RS |
22 | load_lib gdb.exp |
23 | ||
19fa4a0a MW |
24 | # variables that need to set up |
25 | # | |
26 | if ![info exists prompt] then { | |
70dbc751 | 27 | set prompt "\[(\]gdb\[)\]" |
19fa4a0a MW |
28 | } |
29 | # some convenience abbreviations | |
30 | # | |
31 | if ![info exists hex] then { | |
32 | set hex "0x\[0-9A-Fa-f\]+" | |
33 | } | |
34 | if ![info exists decimal] then { | |
35 | set decimal "\[0-9\]+" | |
36 | } | |
37 | ||
38 | # | |
39 | # gdb_version -- extract and print the version number of gcc | |
40 | # | |
41 | proc gdb_version {} { | |
1c65406f | 42 | default_gdb_version |
19fa4a0a MW |
43 | } |
44 | ||
45 | # | |
46 | # gdb_unload -- unload a file if one is loaded | |
47 | # | |
48 | ||
19fa4a0a MW |
49 | # |
50 | # gdb_load -- load a file into the debugger. | |
05a291bb | 51 | # return a -1 if anything goes wrong. |
19fa4a0a MW |
52 | # |
53 | proc gdb_load { arg } { | |
54 | global verbose | |
55 | global loadpath | |
56 | global loadfile | |
57 | global GDB | |
58 | global prompt | |
59 | ||
954f33cf | 60 | return [gdb_file_cmd $arg] |
19fa4a0a MW |
61 | } |
62 | ||
19fa4a0a MW |
63 | # |
64 | # start gdb -- start gdb running | |
65 | # | |
66 | ||
67 | proc gdb_start {} { | |
68 | global verbose | |
69 | global GDB | |
70 | global GDBFLAGS | |
71 | global prompt | |
72 | global spawn_id | |
73 | global timeout | |
70dbc751 | 74 | verbose "Spawning $GDB $GDBFLAGS" |
7e7cb02f | 75 | |
19fa4a0a MW |
76 | set oldtimeout $timeout |
77 | set timeout [expr "$timeout + 60"] | |
78 | if [ llength $GDBFLAGS ] then { | |
32a02b2a | 79 | if {[which $GDB] != 0} then { |
7e7cb02f RS |
80 | spawn $GDB $GDBFLAGS |
81 | } else { | |
85174909 | 82 | perror "$GDB does not exist." |
32a02b2a RS |
83 | exit 1 |
84 | } | |
85 | } else { | |
d4d56ed1 | 86 | if {[which $GDB] != 0} then { |
7e7cb02f | 87 | spawn $GDB |
a309ee82 | 88 | } else { |
85174909 | 89 | perror "$GDB does not exist." |
32a02b2a | 90 | exit 1 |
a309ee82 | 91 | } |
19fa4a0a MW |
92 | } |
93 | expect { | |
70dbc751 RS |
94 | -re ".*\r\n$prompt $" { |
95 | verbose "GDB initialized for native mode" | |
a309ee82 | 96 | } |
a309ee82 | 97 | -re "$prompt $" { |
85174909 | 98 | perror "GDB never initialized." |
a309ee82 RS |
99 | return -1 |
100 | } | |
101 | timeout { | |
85174909 | 102 | perror "(timeout) GDB never initialized." |
a309ee82 | 103 | return -1 |
19fa4a0a | 104 | } |
19fa4a0a MW |
105 | } |
106 | set timeout $oldtimeout | |
107 | # force the height to "unlimited", so no pagers get used | |
108 | send "set height 0\n" | |
a309ee82 RS |
109 | expect { |
110 | -re ".*$prompt $" { | |
70dbc751 | 111 | verbose "Setting height to 0." 2 |
a309ee82 RS |
112 | } |
113 | timeout { | |
114 | warning "Couldn't set the height to 0." | |
115 | } | |
116 | } | |
19fa4a0a MW |
117 | # force the width to "unlimited", so no wraparound occurs |
118 | send "set width 0\n" | |
a309ee82 RS |
119 | expect { |
120 | -re ".*$prompt $" { | |
70dbc751 | 121 | verbose "Seting width to 0." 2 |
a309ee82 RS |
122 | } |
123 | timeout { | |
124 | warning "Couldn't set the width to 0." | |
7e7cb02f | 125 | } |
a309ee82 | 126 | } |
19fa4a0a MW |
127 | } |
128 | ||
7e7cb02f | 129 | proc gdb_exit { } { |
006f1ea2 | 130 | catch default_gdb_exit |
7e7cb02f RS |
131 | } |
132 | ||
19fa4a0a MW |
133 | set binpath /s1/users/rob/vxworks/bin/somewhere-bogus-that-needs-configuring |
134 | set bin $GDB | |
135 | ||
136 | gdb_start | |
137 | ||
a309ee82 RS |
138 | |
139 | ||
140 | ||
141 | ||
142 | ||
143 |