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.arch/] [e500-regs.exp] - Blame information for rev 258

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

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

powered by: WebSVN 2.1.0

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