OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [whatis-exp.exp] - Blame information for rev 178

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 1998, 1999, 2007, 2008 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 3 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, see .
15
 
16
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@prep.ai.mit.edu
18
 
19
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
20
 
21
# This file is part of the gdb testsuite
22
#
23
# tests for whatis command on expressions.
24
# used in file eval.c. This flavor of whatis
25
# command performs evaluation of expressions w/o actually
26
# computing the value, but just the type
27
# of the result. It goes through the evaluate_subexp_standard
28
# with the EVAL_AVOID_SIDE_EFFECTS flag rather than EVAL_NORMAL
29
#
30
 
31
if $tracelevel then {
32
        strace $tracelevel
33
        }
34
 
35
#
36
# test running programs
37
#
38
set prms_id 0
39
set bug_id 0
40
 
41
set testfile "int-type"
42
set srcfile ${testfile}.c
43
set binfile ${objdir}/${subdir}/${testfile}
44
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
45
     untested whatis-exp.exp
46
     return -1
47
    }
48
 
49
 
50
gdb_exit
51
gdb_start
52
gdb_reinitialize_dir $srcdir/$subdir
53
gdb_load ${binfile}
54
 
55
 
56
#
57
# set it up at a breakpoint so we can play with the variable values
58
#
59
 
60
if ![runto_main] then {
61
    perror "couldn't run to breakpoint"
62
    continue
63
}
64
 
65
#
66
# test expressions with "int" types
67
#
68
 
69
gdb_test "set variable x=14" "" "set variable x=14"
70
gdb_test "set variable y=2" "" "set variable y=2"
71
gdb_test "set variable z=2" "" "set variable z=2"
72
gdb_test "set variable w=3" "" "set variable w=3"
73
 
74
send_gdb "print x\n"
75
gdb_expect {
76
    -re ".*14.*$gdb_prompt $" {
77
        pass "print value of x"
78
      }
79
    -re ".*$gdb_prompt $" { fail "print value of x" }
80
    timeout           { fail "(timeout) print value of x" }
81
  }
82
 
83
 
84
send_gdb "print y\n"
85
gdb_expect {
86
    -re ".*2.*$gdb_prompt $" {
87
        pass "print value of y"
88
      }
89
    -re ".*$gdb_prompt $" { fail "print value of y" }
90
    timeout           { fail "(timeout) print value of y" }
91
  }
92
 
93
send_gdb "print z\n"
94
gdb_expect {
95
    -re ".*2.*$gdb_prompt $" {
96
        pass "print value of z"
97
      }
98
    -re ".*$gdb_prompt $" { fail "print value of z" }
99
    timeout           { fail "(timeout) print value of z" }
100
  }
101
 
102
send_gdb "print w\n"
103
gdb_expect {
104
    -re ".*3.*$gdb_prompt $" {
105
        pass "print value of w"
106
      }
107
    -re ".*$gdb_prompt $" { fail "print value of w" }
108
    timeout           { fail "(timeout) print value of w" }
109
  }
110
 
111
 
112
 
113
send_gdb "whatis x+y\n"
114
gdb_expect {
115
    -re ".*type = int.*$gdb_prompt $" {
116
        pass "whatis value of x+y"
117
      }
118
    -re ".*$gdb_prompt $" { fail "whatis value of x+y" }
119
    timeout           { fail "(timeout) whatis value of x+y" }
120
  }
121
 
122
send_gdb "whatis x-y\n"
123
gdb_expect {
124
    -re ".*type = int.*$gdb_prompt $" {
125
        pass "whatis value of x-y"
126
      }
127
    -re ".*$gdb_prompt $" { fail "whatis value of x-y" }
128
    timeout           { fail "(timeout) whatis value of x-y" }
129
  }
130
 
131
send_gdb "whatis x*y\n"
132
gdb_expect {
133
    -re ".*type = int.*$gdb_prompt $" {
134
        pass "whatis value of x*y"
135
      }
136
    -re ".*$gdb_prompt $" { fail "whatis value of x*y" }
137
    timeout           { fail "(timeout) whatis value of x*y" }
138
  }
139
 
140
send_gdb "whatis x/y\n"
141
gdb_expect {
142
    -re ".*type = int.*$gdb_prompt $" {
143
        pass "whatis value of x/y"
144
      }
145
    -re ".*$gdb_prompt $" { fail "whatis value of x/y" }
146
    timeout           { fail "(timeout) whatis value of x/y" }
147
  }
148
 
149
send_gdb "whatis x%y\n"
150
gdb_expect {
151
    -re ".*type = int.*$gdb_prompt $" {
152
        pass "whatis value of x%y"
153
      }
154
    -re ".*$gdb_prompt $" { fail "whatis value of x%y" }
155
    timeout           { fail "(timeout) whatis value of x%y" }
156
  }
157
 
158
 
159
 
160
send_gdb "whatis x=y\n"
161
gdb_expect {
162
    -re ".*type = int.*$gdb_prompt $" {
163
        pass "whatis value of x=y"
164
      }
165
    -re ".*$gdb_prompt $" { fail "whatis value of x=y" }
166
    timeout           { fail "(timeout) whatis value of x=y" }
167
  }
168
 
169
 
170
send_gdb "whatis x+=2\n"
171
gdb_expect {
172
    -re ".*type = int.*$gdb_prompt $" {
173
        pass "whatis value of x+=2"
174
      }
175
    -re ".*$gdb_prompt $" { fail "whatis value of x+=2" }
176
    timeout           { fail "(timeout) whatis value of x+=2" }
177
  }
178
 
179
 
180
send_gdb "whatis ++x\n"
181
gdb_expect {
182
    -re ".*type = int.*$gdb_prompt $" {
183
        pass "whatis value of ++x"
184
      }
185
    -re ".*$gdb_prompt $" { fail "whatis value of ++x" }
186
    timeout           { fail "(timeout) whatis value of ++x" }
187
  }
188
 
189
send_gdb "whatis --x\n"
190
gdb_expect {
191
    -re ".*type = int.*$gdb_prompt $" {
192
        pass "whatis value of --x"
193
      }
194
    -re ".*$gdb_prompt $" { fail "whatis value of --x" }
195
    timeout           { fail "(timeout) whatis value of --x" }
196
  }
197
 
198
send_gdb "whatis x++\n"
199
gdb_expect {
200
    -re ".*type = int.*$gdb_prompt $" {
201
        pass "whatis value of x++"
202
      }
203
    -re ".*$gdb_prompt $" { fail "whatis value of x++" }
204
    timeout           { fail "(timeout) whatis value of x++" }
205
  }
206
 
207
send_gdb "whatis x--\n"
208
gdb_expect {
209
    -re ".*type = int.*$gdb_prompt $" {
210
        pass "whatis value of x--"
211
      }
212
    -re ".*$gdb_prompt $" { fail "whatis value of x--" }
213
    timeout           { fail "(timeout) whatis value of x--" }
214
  }
215
 
216
gdb_exit
217
return 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.