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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.arch/] [e500-regs.exp] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2003, 2004, 2007, 2008, 2009, 2010 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
 
17
# Tests for Powerpc E500 register setting and fetching
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
#
24
# Test the use of registers, especially E500 registers, for Powerpc.
25
# This file uses e500-regs.c for input.
26
#
27
 
28
set prms_id 0
29
set bug_id 0
30
 
31
if ![istarget "powerpc-*eabispe"] then {
32
    verbose "Skipping e500 register tests."
33
    return
34
}
35
 
36
set testfile "e500-regs"
37
set binfile ${objdir}/${subdir}/${testfile}
38
set src1 ${srcdir}/${subdir}/${testfile}.c
39
 
40
if  { [gdb_compile ${src1} ${binfile} executable {debug nowarnings}] != "" } {
41
     untested e500-regs.exp
42
     return -1
43
}
44
 
45
gdb_start
46
gdb_reinitialize_dir $srcdir/$subdir
47
gdb_load ${binfile}
48
 
49
#
50
# Run to `main' where we begin our tests.
51
#
52
 
53
if ![runto_main] then {
54
    gdb_suppress_tests
55
}
56
 
57
# set all the registers integer portions to 1
58
for {set i 0} {$i < 32} {incr i 1} {
59
        for {set j 0} {$j < 2} {incr j 1} {
60
           gdb_test "set \$ev$i.v2_int32\[$j\] = 1" "" "set reg ev$i.v4si.f\[$j\]"
61
        }
62
}
63
 
64
# Now execute some target code, so that GDB's register cache is flushed.
65
 
66
#gdb_test "next" "" ""
67
 
68
send_gdb "show endian\n"
69
gdb_expect {
70
    -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
71
        pass "endianness"
72
        set endianness $expect_out(2,string)
73
    }
74
    -re ".*$gdb_prompt $" {
75
        fail "couldn't get endianness"
76
    }
77
    timeout             { fail "(timeout) endianness" }
78
}
79
 
80
# And then read the E500 registers back, to see that
81
# a) the register write above worked, and
82
# b) the register read (below) also works.
83
 
84
if {$endianness == "big"} {
85
set vector_register ".uint64 = 0x100000001, v2_float = .0x0, 0x0., v2_int32 = .0x1, 0x1., v4_int16 = .0x0, 0x1, 0x0, 0x1., v8_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
86
} else {
87
set vector_register ".uint64 = 0x100000001, v2_float = .0x0, 0x0., v2_int32 = .0x1, 0x1., v4_int16 = .0x1, 0x0, 0x1, 0x0., v8_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
88
}
89
 
90
for {set i 0} {$i < 32} {incr i 1} {
91
        gdb_test "info reg ev$i" "ev$i.*$vector_register" "info reg ev$i"
92
}
93
 
94
# Test wether the GPRs are updated accordingly. (GPRs are just the lower
95
# 32 bits of the EV registers.)
96
 
97
set general_register "0x1\[ \t\]+1"
98
 
99
for {set i 0} {$i < 32} {incr i 1} {
100
        gdb_test "info reg r$i" "r$i.*$general_register" "info reg r$i"
101
}
102
 
103
# Now redo the same tests, but using the print command.
104
 
105
if {$endianness == "big"} {
106
     set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .0, 1, 0, 1., v8_int8 = .0, 0, 0, 1, 0, 0, 0, 1.."
107
} else {
108
     set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .1, 0, 1, 0., v8_int8 = .1, 0, 0, 0, 1, 0, 0, 0.."
109
}
110
 
111
for {set i 0} {$i < 32} {incr i 1} {
112
        gdb_test "print \$ev$i" ".* = $decimal_vector" "print ev$i"
113
}
114
 
115
for {set i 0} {$i < 32} {incr i 1} {
116
         set pattern$i ".*ev$i.*"
117
         append pattern$i $vector_register
118
}
119
 
120
send_gdb "info vector\n"
121
gdb_expect_list "info vector" ".*$gdb_prompt $" {
122
[$pattern0]
123
[$pattern1]
124
[$pattern2]
125
[$pattern3]
126
[$pattern4]
127
[$pattern5]
128
[$pattern6]
129
[$pattern7]
130
[$pattern8]
131
[$pattern9]
132
[$pattern10]
133
[$pattern11]
134
[$pattern12]
135
[$pattern13]
136
[$pattern14]
137
[$pattern15]
138
[$pattern16]
139
[$pattern17]
140
[$pattern18]
141
[$pattern19]
142
[$pattern20]
143
[$pattern21]
144
[$pattern22]
145
[$pattern23]
146
[$pattern24]
147
[$pattern25]
148
[$pattern26]
149
[$pattern27]
150
[$pattern28]
151
[$pattern29]
152
[$pattern30]
153
[$pattern31]
154
}
155
 
156
# We must restart everything, because we have set important registers to
157
# some unusual values.
158
 
159
gdb_exit
160
gdb_start
161
gdb_reinitialize_dir $srcdir/$subdir
162
gdb_load ${binfile}
163
if ![runto_main] then {
164
    gdb_suppress_tests
165
}
166
 
167
gdb_test "break vector_fun" \
168
 "Breakpoint 2 at.*e500-regs.c, line \[0-9\]+\\." \
169
 "Set breakpoint at vector_fun"
170
 
171
# Actually it is nuch easier to see these results printed in hex.
172
# gdb_test "set output-radix 16" \
173
#   "Output radix now set to decimal 16, hex 10, octal 20." \
174
#   "Set output radix to hex"
175
 
176
gdb_test "continue" \
177
  "Breakpoint 2, vector_fun .a=.-2, -2., b=.1, 1.*e500-regs.c.*ev_create_s32 .2, 2.;" \
178
  "continue to vector_fun"
179
 
180
# Do a next over the assignment to vector 'a'.
181
gdb_test "next" ".*b = \\(vector int\\) __ev_create_s32 \\(3, 3\\);" \
182
  "next (1)"
183
 
184
# Do a next over the assignment to vector 'b'.
185
gdb_test "next" "c = __ev_and \\(a, b\\);" \
186
  "next (2)"
187
 
188
# Now 'a' should be '0x02020202...' and 'b' should be '0x03030303...'
189
gdb_test "print/x a" \
190
  ".*= .0x2, 0x2." \
191
  "print vector parameter a"
192
 
193
gdb_test "print/x b" \
194
  ".*= .0x3, 0x3." \
195
  "print vector parameter b"
196
 
197
# If we do an 'up' now, and print 'x' and 'y' we should see the values they
198
# have in main, not the values they have in vector_fun.
199
gdb_test "up" ".1.*main \\(\\) at.*e500-regs.c.*z = vector_fun \\(x, y\\);" \
200
  "up to main"
201
 
202
gdb_test "print x" \
203
  ".*= .-2, -2." \
204
  "print vector x"
205
 
206
gdb_test "print y" \
207
  ".*= .1, 1." \
208
  "print vector y"
209
 
210
# now go back to vector_func and do a finish, to see if we can print the return
211
# value correctly.
212
 
213
gdb_test "down" \
214
  ".0  vector_fun \\(a=.2, 2., b=.3, 3.\\) at.*e500-regs.c.*c = __ev_and \\(a, b\\);" \
215
  "down to vector_fun"
216
 
217
gdb_test "finish" \
218
  "Run till exit from .0  vector_fun \\(a=.2, 2., b=.3, 3.\\) at.*e500-regs.c.*main \\(\\) at.*e500-regs.c.*z = vector_fun \\(x, y\\);.*Value returned is.*= .2, 2." \
219
  "finish returned correct value"
220
 
221
 
222
 

powered by: WebSVN 2.1.0

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