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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [exprs.exp] - Blame information for rev 252

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

Line No. Rev Author Line
1 227 jeremybenn
#   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000,
2
#   2001, 2003, 2007, 2008, 2009, 2010 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 3 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, see .
16
 
17
# This file was written by Rob Savoye. (rob@cygnus.com)
18
 
19
if $tracelevel {
20
    strace $tracelevel
21
}
22
 
23
#
24
# test running programs
25
#
26
set prms_id 0
27
set bug_id 0
28
 
29
set testfile "exprs"
30
set srcfile ${testfile}.c
31
set binfile ${objdir}/${subdir}/${testfile}
32
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
33
     untested exprs.exp
34
     return -1
35
}
36
 
37
if [get_compiler_info ${binfile}] {
38
    return -1;
39
}
40
 
41
gdb_exit
42
gdb_start
43
gdb_reinitialize_dir $srcdir/$subdir
44
gdb_load ${binfile}
45
 
46
#
47
# set it up at a breakpoint so we can play with the variable values
48
#
49
 
50
if ![runto_main] then {
51
    perror "couldn't run to breakpoint"
52
    continue
53
}
54
 
55
proc test_expr { args } {
56
    if { [llength $args] % 2 } {
57
        warning "an even # of arguments should be passed to test_expr"
58
    }
59
    set last_ent [expr [llength $args] - 1];
60
    set testname [lindex $args $last_ent];
61
    if [gdb_test [lindex $args 0] "" "$testname (setup)"] {
62
        gdb_suppress_tests;
63
    }
64
    for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
65
        if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname ([lindex $args $x])"] {
66
            gdb_suppress_tests;
67
        }
68
    }
69
    gdb_stop_suppressing_tests;
70
}
71
#
72
# test expressions with "char" types
73
#
74
test_expr "set variable v_char=127" "print v_char == 0" "\\$\[0-9\]* = $false"  "print v_char == 127" "\\$\[0-9\]* = $true"  "print char =="
75
test_expr "set variable v_char=127" "print v_char != 0" "\\$\[0-9\]* = $true"  "print v_char != 127" "\\$\[0-9\]* = $false"  "print char !="
76
test_expr "set variable v_char=127" "print v_char < 0" "\\$\[0-9\]* = $false"  "print v_char < 127" "\\$\[0-9\]* = $false"  "print char <"
77
test_expr "set variable v_char=127" "print v_char > 0" "\\$\[0-9\]* = $true"  "print v_char > 127" "\\$\[0-9\]* = $false"  "print char >"
78
#
79
# test expressions with "signed char" types
80
#
81
test_expr "set variable v_signed_char=127" "print v_signed_char == 0" "\\$\[0-9\]* = $false"  "print v_signed_char == 127" "\\$\[0-9\]* = $true"  "print signed char =="
82
test_expr "set variable v_signed_char=127" "print v_signed_char != 0" "\\$\[0-9\]* = $true"  "print v_signed_char != 127" "\\$\[0-9\]* = $false"  "print signed char !="
83
test_expr "set variable v_signed_char=127" "print v_signed_char < 0" "\\$\[0-9\]* = $false"  "print v_signed_char < 127" "\\$\[0-9\]* = $false"  "print signed char <"
84
test_expr "set variable v_signed_char=127" "print v_signed_char > 0" "\\$\[0-9\]* = $true"  "print v_signed_char > 127" "\\$\[0-9\]* = $false"  "print signed char >"
85
# make char a minus
86
test_expr "set variable v_signed_char=-1" "print v_signed_char == 0" "\\$\[0-9\]* = $false"  "print v_signed_char == -1" "\\$\[0-9\]* = $true"  "print signed char == (minus)"
87
test_expr "set variable v_signed_char=-1" "print v_signed_char != 0" "\\$\[0-9\]* = $true"  "print v_signed_char != -1" "\\$\[0-9\]* = $false"  "print signed char != (minus)"
88
test_expr "set variable v_signed_char=-1" "print v_signed_char < 0" "\\$\[0-9\]* = $true"  "print v_signed_char < 127" "\\$\[0-9\]* = $true"  "print signed char < (minus)"
89
test_expr "set variable v_signed_char=-1" "print v_signed_char > 0" "\\$\[0-9\]* = $false"  "print v_signed_char > 127" "\\$\[0-9\]* = $false"  "print signed char > (minus)"
90
#
91
# test expressions with "unsigned char" types
92
#
93
test_expr "set variable v_unsigned_char=127" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_char == 127" "\\$\[0-9\]* = $true"  "print unsigned char =="
94
test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_char != 127" "\\$\[0-9\]* = $false"  "print unsigned char !="
95
test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_char < 127" "\\$\[0-9\]* = $false"  "print unsigned char <"
96
test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_char > 127" "\\$\[0-9\]* = $false"  "print unsigned char >"
97
# make char a minus
98
test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_char == ~0" "\\$\[0-9\]* = $false"  "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = $true" "print unsigned char == (~0)"
99
test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = $false"  "print v_unsigned_char != ~0" "\\$\[0-9\]* = $true" "print unsigned char != (~0)"
100
test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_char < 127" "\\$\[0-9\]* = $false"  "print unsigned char < (~0)"
101
test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_char > 127" "\\$\[0-9\]* = $true"  "print unsigned char > (~0)"
102
#
103
# test expressions with "short" types
104
#
105
test_expr "set variable v_short=0x7FFF" "print v_short == 0" "\\$\[0-9\]* = $false"  "print v_short == 0x7FFF" "\\$\[0-9\]* = $true"  "print signed short =="
106
test_expr "set variable v_short=0x7FFF" "print v_short != 0" "\\$\[0-9\]* = $true"  "print v_short != 0x7FFF" "\\$\[0-9\]* = $false"  "print signed short !="
107
test_expr "set variable v_short=0x7FFF" "print v_short < 0" "\\$\[0-9\]* = $false"  "print v_short < 0x7FFF" "\\$\[0-9\]* = $false"  "print signed short <"
108
test_expr "set variable v_short=0x7FFF" "print v_short > 0" "\\$\[0-9\]* = $true"  "print v_short > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed short >"
109
# make short a minus
110
test_expr "set variable v_short=-1" "print v_short == 0" "\\$\[0-9\]* = $false"  "print v_short == -1" "\\$\[0-9\]* = $true"  "print signed short == (minus)"
111
test_expr "set variable v_short=-1" "print v_short != 0" "\\$\[0-9\]* = $true"  "print v_short != -1" "\\$\[0-9\]* = $false"  "print signed short != (minus)"
112
test_expr "set variable v_short=-1" "print v_short < 0" "\\$\[0-9\]* = $true"  "print v_short < 0x7FFF" "\\$\[0-9\]* = $true"  "print signed short < (minus)"
113
test_expr "set variable v_short=-1" "print v_short > 0" "\\$\[0-9\]* = $false"  "print v_short > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed short > (minus)"
114
#
115
# test expressions with "signed short" types
116
#
117
test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short == 0" "\\$\[0-9\]* = $false"  "print v_signed_short == 0x7FFF" "\\$\[0-9\]* = $true"  "print signed signed short =="
118
test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short != 0" "\\$\[0-9\]* = $true"  "print v_signed_short != 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed short !="
119
test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short < 0" "\\$\[0-9\]* = $false"  "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed short <"
120
test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short > 0" "\\$\[0-9\]* = $true"  "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed short >"
121
# make short a minus
122
test_expr "set variable v_signed_short=-1" "print v_signed_short == 0" "\\$\[0-9\]* = $false"  "print v_signed_short == -1" "\\$\[0-9\]* = $true"  "print signed signed short == (minus)"
123
test_expr "set variable v_signed_short=-1" "print v_signed_short != 0" "\\$\[0-9\]* = $true"  "print v_signed_short != -1" "\\$\[0-9\]* = $false"  "print signed signed short != (minus)"
124
test_expr "set variable v_signed_short=-1" "print v_signed_short < 0" "\\$\[0-9\]* = $true"  "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = $true"  "print signed signed short < (minus)"
125
test_expr "set variable v_signed_short=-1" "print v_signed_short > 0" "\\$\[0-9\]* = $false"  "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed short > (minus)"
126
#
127
# test expressions with "unsigned short" types
128
#
129
test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_short == 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned short =="
130
test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_short != 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned short !="
131
test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned short <"
132
test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned short >"
133
# make short a minus
134
test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false"  "print sizeof (v_unsigned_short) < sizeof (~0) && v_unsigned_short == ~0" "\\$\[0-9\]* = $false"  "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = $true"  "print unsigned short == (~0)"
135
test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = $false"  "print unsigned short != (~0)"
136
test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned short < (~0)"
137
test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned short > (~0)"
138
#
139
# test expressions with "int" types
140
#
141
test_expr "set variable v_int=0x7FFF" "print v_int == 0" "\\$\[0-9\]* = $false"  "print v_int == 0x7FFF" "\\$\[0-9\]* = $true"  "print signed int =="
142
test_expr "set variable v_int=0x7FFF" "print v_int != 0" "\\$\[0-9\]* = $true"  "print v_int != 0x7FFF" "\\$\[0-9\]* = $false"  "print signed int !="
143
test_expr "set variable v_int=0x7FFF" "print v_int < 0" "\\$\[0-9\]* = $false"  "print v_int < 0x7FFF" "\\$\[0-9\]* = $false"  "print signed int <"
144
test_expr "set variable v_int=0x7FFF" "print v_int > 0" "\\$\[0-9\]* = $true"  "print v_int > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed int >"
145
# make int a minus
146
test_expr "set variable v_int=-1" "print v_int == 0" "\\$\[0-9\]* = $false"  "print v_int == -1" "\\$\[0-9\]* = $true"  "print signed int == (minus)"
147
test_expr "set variable v_int=-1" "print v_int != 0" "\\$\[0-9\]* = $true"  "print v_int != -1" "\\$\[0-9\]* = $false"  "print signed int != (minus)"
148
test_expr "set variable v_int=-1" "print v_int < 0" "\\$\[0-9\]* = $true"  "print v_int < 0x7FFF" "\\$\[0-9\]* = $true"  "print signed int < (minus)"
149
test_expr "set variable v_int=-1" "print v_int > 0" "\\$\[0-9\]* = $false"  "print v_int > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed int > (minus)"
150
#
151
# test expressions with "signed int" types
152
#
153
test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int == 0" "\\$\[0-9\]* = $false"  "print v_signed_int == 0x7FFF" "\\$\[0-9\]* = $true"  "print signed signed int =="
154
test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int != 0" "\\$\[0-9\]* = $true"  "print v_signed_int != 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed int !="
155
test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int < 0" "\\$\[0-9\]* = $false"  "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed int <"
156
test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int > 0" "\\$\[0-9\]* = $true"  "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed int >"
157
# make int a minus
158
test_expr "set variable v_signed_int=-1" "print v_signed_int == 0" "\\$\[0-9\]* = $false"  "print v_signed_int == -1" "\\$\[0-9\]* = $true"  "print signed signed int == (minus)"
159
test_expr "set variable v_signed_int=-1" "print v_signed_int != 0" "\\$\[0-9\]* = $true"  "print v_signed_int != -1" "\\$\[0-9\]* = $false"  "print signed signed int != (minus)"
160
test_expr "set variable v_signed_int=-1" "print v_signed_int < 0" "\\$\[0-9\]* = $true"  "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = $true"  "print signed signed int < (minus)"
161
test_expr "set variable v_signed_int=-1" "print v_signed_int > 0" "\\$\[0-9\]* = $false"  "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed int > (minus)"
162
#
163
# test expressions with "unsigned int" types
164
#
165
test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_int == 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned int =="
166
test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_int != 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned int !="
167
test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned int <"
168
test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned int >"
169
# make int a minus
170
test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_int == ~0" "\\$\[0-9\]* = $true"  "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = $true"  "print unsigned int == (~0)"
171
test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_int != (unsigned int)~0" "\\$\[0-9\]* = $false"  "print unsigned int != (~0)"
172
test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned int < (~0)"
173
test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned int > (~0)"
174
#
175
# test expressions with "long" types
176
#
177
test_expr "set variable v_long=0x7FFF" "print v_long == 0" "\\$\[0-9\]* = $false"  "print v_long == 0x7FFF" "\\$\[0-9\]* = $true"  "print signed long =="
178
test_expr "set variable v_long=0x7FFF" "print v_long != 0" "\\$\[0-9\]* = $true"  "print v_long != 0x7FFF" "\\$\[0-9\]* = $false"  "print signed long !="
179
test_expr "set variable v_long=0x7FFF" "print v_long < 0" "\\$\[0-9\]* = $false"  "print v_long < 0x7FFF" "\\$\[0-9\]* = $false"  "print signed long <"
180
test_expr "set variable v_long=0x7FFF" "print v_long > 0" "\\$\[0-9\]* = $true"  "print v_long > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed long >"
181
# make long a minus
182
test_expr "set variable v_long=-1" "print v_long == 0" "\\$\[0-9\]* = $false"  "print v_long == -1" "\\$\[0-9\]* = $true"  "print signed long == (minus)"
183
test_expr "set variable v_long=-1" "print v_long != 0" "\\$\[0-9\]* = $true"  "print v_long != -1" "\\$\[0-9\]* = $false"  "print signed long != (minus)"
184
test_expr "set variable v_long=-1" "print v_long < 0" "\\$\[0-9\]* = $true"  "print v_long < 0x7FFF" "\\$\[0-9\]* = $true"  "print signed long < (minus)"
185
test_expr "set variable v_long=-1" "print v_long > 0" "\\$\[0-9\]* = $false"  "print v_long > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed long > (minus)"
186
#
187
# test expressions with "signed long" types
188
#
189
test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long == 0" "\\$\[0-9\]* = $false"  "print v_signed_long == 0x7FFF" "\\$\[0-9\]* = $true"  "print signed signed long =="
190
test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long != 0" "\\$\[0-9\]* = $true"  "print v_signed_long != 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed long !="
191
test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long < 0" "\\$\[0-9\]* = $false"  "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed long <"
192
test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long > 0" "\\$\[0-9\]* = $true"  "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed long >"
193
# make long a minus
194
test_expr "set variable v_signed_long=-1" "print v_signed_long == 0" "\\$\[0-9\]* = $false"  "print v_signed_long == -1" "\\$\[0-9\]* = $true"  "print signed signed long == (minus)"
195
test_expr "set variable v_signed_long=-1" "print v_signed_long != 0" "\\$\[0-9\]* = $true"  "print v_signed_long != -1" "\\$\[0-9\]* = $false"  "print signed signed long != (minus)"
196
test_expr "set variable v_signed_long=-1" "print v_signed_long < 0" "\\$\[0-9\]* = $true"  "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = $true"  "print signed signed long < (minus)"
197
test_expr "set variable v_signed_long=-1" "print v_signed_long > 0" "\\$\[0-9\]* = $false"  "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = $false"  "print signed signed long > (minus)"
198
#
199
# test expressions with "unsigned long" types
200
#
201
test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_long == 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned long =="
202
test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long != 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned long !="
203
test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned long <"
204
test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned long >"
205
# make long a minus
206
test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_long == ~0" "\\$\[0-9\]* = $true"  "print v_unsigned_long == (unsigned long)~0" "\\$\[0-9\]* = $true"  "print unsigned long == (~0)"
207
test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = $false"  "print unsigned long != (~0)"
208
test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned long < (~0)"
209
test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned long > (~0)"
210
#
211
# Test expressions with casts to a pointer.
212
# NB: Some architectures convert a ``NULL'' pointer into
213
#     something else. Don't simply test for 0.
214
#
215
test_expr "set variable v_signed_char = 0" "print (void*)v_signed_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_char"
216
test_expr "set variable v_signed_short = 0" "print (void*)v_signed_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_short"
217
test_expr "set variable v_signed_int = 0" "print (void*)v_signed_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_int"
218
test_expr "set variable v_signed_long = 0" "print (void*)v_signed_long" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_long"
219
test_expr "set variable v_unsigned_char = 0" "print (void*)v_unsigned_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_char"
220
test_expr "set variable v_unsigned_short = 0" "print (void*)v_unsigned_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_short"
221
test_expr "set variable v_unsigned_int = 0" "print (void*)v_unsigned_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_int"
222
test_expr "set variable v_unsigned_long = 0" "print (void*)v_unsigned_long" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_long"
223
#
224
# Test expressions with pointers out of range
225
#
226
# NB: For some architectures, all of sizeof(long),
227
#     sizeof(long long) and sizeof(void*) are
228
#     the same size so this test can not work.
229
#
230
send_gdb "print sizeof (long long) > sizeof (long)\n"
231
gdb_expect {
232
    -re "\\$\[0-9\]* = $true.*$gdb_prompt" {
233
        set ok 1
234
        pass "sizeof (long long) > sizeof (long) (true)"
235
    }
236
    -re "\\$\[0-9\]* = $false.*$gdb_prompt" {
237
        set ok 0
238
        pass "sizeof (long long) > sizeof (long) (false)"
239
    }
240
    timeout {
241
        set ok 0
242
        fail "sizeof (long long) > sizeof (long) (timeout)"
243
    }
244
}
245
if [expr ! $ok] { setup_xfail "*-*-*" }
246
gdb_test "print (void*) ((long long) (unsigned long) -1 + 1)" \
247
        "warning: value truncated.*" "truncate (void*) 0x00000000ffffffff + 1"
248
if [expr ! $ok] { setup_xfail "*-*-*" }
249
gdb_test "print (void*) (~((long long)(unsigned long) -1) - 1)" \
250
        "warning: value truncated.*" "truncate (void*) 0xffffffff00000000 - 1"
251
 
252
# String concatentation.
253
test_expr "print \"x\" \"y\"" "\\$\[0-9\]* = \"xy\""
254
test_expr "print \"x\" \"y\" \"z\"" "\\$\[0-9\]* = \"xyz\""
255
 
256
# Enum formatting tests.
257
test_expr "print red" "\\$\[0-9\]* = red"
258
gdb_test "set output-radix 8" ""
259
test_expr "print red" "\\$\[0-9\]* = red"
260
test_expr "print/d red" "\\$\[0-9\]* = 0"
261
gdb_test "set output-radix 10" ""

powered by: WebSVN 2.1.0

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