1 |
227 |
jeremybenn |
# Copyright 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 |
|
|
# This file is part of the gdb testsuite.
|
17 |
|
|
|
18 |
|
|
if $tracelevel {
|
19 |
|
|
strace $tracelevel
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
set prms_id 0
|
23 |
|
|
set bug_id 0
|
24 |
|
|
|
25 |
|
|
if ![istarget "i?86-*linux*"] then {
|
26 |
|
|
verbose "Skipping i387 reverse float tests."
|
27 |
|
|
return
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
set testfile "i387-stack-reverse"
|
31 |
|
|
set srcfile ${testfile}.c
|
32 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
33 |
|
|
|
34 |
|
|
# some targets have leading underscores on assembly symbols.
|
35 |
|
|
# TODO: detect this automatically
|
36 |
|
|
set additional_flags ""
|
37 |
|
|
if [istarget "i?86-*-cygwin*"] then {
|
38 |
|
|
set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
|
42 |
|
|
untested i387-float-reverse
|
43 |
|
|
return -1
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
# Get things started.
|
47 |
|
|
|
48 |
|
|
gdb_exit
|
49 |
|
|
gdb_start
|
50 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
51 |
|
|
gdb_load ${binfile}
|
52 |
|
|
runto main
|
53 |
|
|
|
54 |
|
|
# Record to end of main
|
55 |
|
|
|
56 |
|
|
set location [gdb_get_line_number "END I387-FLOAT-REVERSE"]
|
57 |
|
|
gdb_test "record" "" "Turn on process record"
|
58 |
|
|
gdb_test "until $location" ".*/$srcfile:$location.*" \
|
59 |
|
|
"record to end of main"
|
60 |
|
|
|
61 |
|
|
# Now rewind to beginning so we can begin testing.
|
62 |
|
|
|
63 |
|
|
set location [gdb_get_line_number "BEGIN I387-FLOAT-REVERSE"]
|
64 |
|
|
gdb_test "set exec-dir reverse" "" "set reverse direction"
|
65 |
|
|
gdb_test "until $location" ".*/$srcfile:$location.*" \
|
66 |
|
|
"rewind to beginning of main"
|
67 |
|
|
gdb_test "set exec-dir forward" "" "set forward direction"
|
68 |
|
|
|
69 |
|
|
# Test FPU stack. FPU stack includes st0, st1, st2, st3, st4,
|
70 |
|
|
# st5, st6, st7. We push 8 values to FPU stack in record mode
|
71 |
|
|
# and see whether all are getting recorded.
|
72 |
|
|
|
73 |
|
|
set location [gdb_get_line_number "test st0 register"]
|
74 |
|
|
gdb_test "until $location" ".*/$srcfile:$location.*asm.*fld1.*" \
|
75 |
|
|
"begin test st0"
|
76 |
|
|
gdb_test "stepi" "asm.*fldl2t.*" "push st0 == 1"
|
77 |
|
|
gdb_test "info register st0" "st0 *1\t.*" "verify st0 == 1"
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
gdb_test "stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
81 |
|
|
gdb_test "info register st0" "st0 *3.32192.*\t.*" "verify st0 == 3.321928094*"
|
82 |
|
|
gdb_test "info register st1" "st1 *1\t.*" "verify st1 == 1"
|
83 |
|
|
|
84 |
|
|
gdb_test "stepi" "asm.*fldpi.*" "push st0 == 1.4426950406*"
|
85 |
|
|
gdb_test "info register st0" "st0 *1.44269.*\t.*" "verify st0 == 1.442695040*"
|
86 |
|
|
gdb_test "info register st1" "st1 *3.32192.*\t.*" "verify st1 == 3.3219280948*"
|
87 |
|
|
gdb_test "info register st2" "st2 *1\t.*" "verify st2 == 1"
|
88 |
|
|
|
89 |
|
|
gdb_test "stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
90 |
|
|
gdb_test "info register st0" "st0 *3.14159.*\t.*" "verify st0 == 3.14159265*"
|
91 |
|
|
gdb_test "info register st1" "st1 *1.44269.*\t.*" "verify st1 == 1.4426950*"
|
92 |
|
|
gdb_test "info register st2" "st2 *3.32192.*\t.*" "verify st2 == 3.3219280*"
|
93 |
|
|
gdb_test "info register st3" "st3 *1\t.*" "verify st3 == 1"
|
94 |
|
|
|
95 |
|
|
gdb_test "stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
96 |
|
|
gdb_test "info register st0" "st0 *0.30102.*\t.*" "verify st0 == 0.301029*"
|
97 |
|
|
gdb_test "info register st1" "st1 *3.14159.*\t.*" "verify st1 == 3.14159265*"
|
98 |
|
|
gdb_test "info register st2" "st2 *1.44269.*\t.*" "verify st2 == 1.44269506*"
|
99 |
|
|
gdb_test "info register st3" "st3 *3.32192.*\t.*" "verify st3 == 3.3219280948*"
|
100 |
|
|
gdb_test "info register st4" "st4 *1\t.*" "verify st4 == 1"
|
101 |
|
|
|
102 |
|
|
gdb_test "stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
103 |
|
|
gdb_test "info register st0" "st0 *0.69314.*\t.*" "verify st0 == 0.69314*"
|
104 |
|
|
gdb_test "info register st1" "st1 *0.30102.*\t.*" "verify st1 == 0.301029*"
|
105 |
|
|
gdb_test "info register st2" "st2 *3.14159.*\t.*" "verify st2 == 3.14159265*"
|
106 |
|
|
gdb_test "info register st3" "st3 *1.44269.*\t.*" "verify st3 == 1.442695040*"
|
107 |
|
|
gdb_test "info register st4" "st4 *3.32192.*\t.*" "verify st4 == 3.3219280948*"
|
108 |
|
|
gdb_test "info register st5" "st5 *1\t.*" "verify st5 == 1"
|
109 |
|
|
|
110 |
|
|
gdb_test "stepi" "asm.*fld1.*" "push st0 == 0"
|
111 |
|
|
gdb_test "info register st0" "st0 *0\t.*" "verify st0 == 0"
|
112 |
|
|
gdb_test "info register st1" "st1 *0.69314.*\t.*" "verify st1 == 0.69314*"
|
113 |
|
|
gdb_test "info register st2" "st2 *0.30102.*\t.*" "verify st2 == 0.301029*"
|
114 |
|
|
gdb_test "info register st3" "st3 *3.14159.*\t.*" "verify st3 == 3.14159265*"
|
115 |
|
|
gdb_test "info register st4" "st4 *1.44269.*\t.*" "verify st4 == 1.442695040*"
|
116 |
|
|
gdb_test "info register st5" "st5 *3.32192.*\t.*" "verify st5 == 3.32192809*"
|
117 |
|
|
gdb_test "info register st6" "st6 *1\t.*" "verify st6 == 1"
|
118 |
|
|
|
119 |
|
|
gdb_test "stepi" "asm.*nop.*" "push st0 == 0"
|
120 |
|
|
gdb_test "info register st0" "st0 *1\t.*" "verify st0 == 1"
|
121 |
|
|
gdb_test "info register st1" "st1 *0\t.*" "verify st1 == 0"
|
122 |
|
|
gdb_test "info register st2" "st2 *0.69314.*\t.*" "verify st2 == 0.69314*"
|
123 |
|
|
gdb_test "info register st3" "st3 *0.30102.*\t.*" "verify st3 == 0.301029*"
|
124 |
|
|
gdb_test "info register st4" "st4 *3.14159.*\t.*" "verify st4 == 3.14159265*"
|
125 |
|
|
gdb_test "info register st5" "st5 *1.44269.*\t.*" "verify st5 == 1.44269504*"
|
126 |
|
|
gdb_test "info register st6" "st6 *3.32192.*\t.*" "verify st6 == 3.3219280948*"
|
127 |
|
|
gdb_test "info register st7" "st7 *1.*" "verify st7 == 1"
|
128 |
|
|
|
129 |
|
|
# Now step backward, and check that st0 value reverts to zero.
|
130 |
|
|
|
131 |
|
|
gdb_test "reverse-stepi" "asm.*fld1.*" "undo registers, st0-st7"
|
132 |
|
|
gdb_test "info register st0" "st0 *0\t.*" "verify st0 == 0"
|
133 |
|
|
gdb_test "info register st1" "st1 *0.69314.*\t.*" "verify st1 == 0.69314*"
|
134 |
|
|
gdb_test "info register st2" "st2 *0.30102.*\t.*" "verify st2 == 0.301029*"
|
135 |
|
|
gdb_test "info register st3" "st3 *3.14159.*\t.*" "verify st3 == 3.14159265*"
|
136 |
|
|
gdb_test "info register st4" "st4 *1.44269.*\t.*" "verify st4 == 1.442695040*"
|
137 |
|
|
gdb_test "info register st5" "st5 *3.32192.*\t.*" "verify st5 == 3.3219280948*"
|
138 |
|
|
gdb_test "info register st6" "st6 *1\t.*" "verify st6 == 1"
|
139 |
|
|
|
140 |
|
|
gdb_test "reverse-stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
141 |
|
|
gdb_test "info register st0" "st0 *0.69314.*\t.*" "verify st0 == 0.69314*"
|
142 |
|
|
gdb_test "info register st1" "st1 *0.30102.*\t.*" "verify st1 == 0.301029*"
|
143 |
|
|
gdb_test "info register st2" "st2 *3.14159.*\t.*" "verify st2 == 3.14159265*"
|
144 |
|
|
gdb_test "info register st3" "st3 *1.44269.*\t.*" "verify st3 == 1.442695040*"
|
145 |
|
|
gdb_test "info register st4" "st4 *3.32192.*\t.*" "verify st4 == 3.3219280948*"
|
146 |
|
|
gdb_test "info register st5" "st5 *1\t.*" "verify st5 == 1"
|
147 |
|
|
|
148 |
|
|
gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
149 |
|
|
gdb_test "info register st0" "st0 *0.30102.*\t.*" "verify st0 == 0.301029*"
|
150 |
|
|
gdb_test "info register st1" "st1 *3.14159.*\t.*" "verify st1 == 3.14159265*"
|
151 |
|
|
gdb_test "info register st2" "st2 *1.44269.*\t.*" "verify st2 == 1.442695040*"
|
152 |
|
|
gdb_test "info register st3" "st3 *3.32192.*\t.*" "verify st3 == 3.3219280948*"
|
153 |
|
|
gdb_test "info register st4" "st4 *1\t.*" "verify st4 == 1"
|
154 |
|
|
|
155 |
|
|
gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
156 |
|
|
gdb_test "info register st0" "st0 *3.14159.*\t.*" "verify st0 == 3.14159265*"
|
157 |
|
|
gdb_test "info register st1" "st1 *1.44269.*\t.*" "verify st1 == 1.442695040*"
|
158 |
|
|
gdb_test "info register st2" "st2 *3.32192.*\t.*" "verify st2 == 3.3219280948*"
|
159 |
|
|
gdb_test "info register st3" "st3 *1\t.*" "verify st3 == 1"
|
160 |
|
|
|
161 |
|
|
gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0 == 1.44269504088*"
|
162 |
|
|
gdb_test "info register st0" "st0 *1.44269.*\t.*" "verify st0 == 1.442695040*"
|
163 |
|
|
gdb_test "info register st1" "st1 *3.32192.*\t.*" "verify st1 == 3.3219280948*"
|
164 |
|
|
gdb_test "info register st2" "st2 *1\t.*" "verify st2 == 1"
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
168 |
|
|
gdb_test "info register st0" "st0 *3.32192.*\t.*" "verify st0 == 3.3219280948*"
|
169 |
|
|
gdb_test "info register st1" "st1 *1\t.*" "verify st1 == 1"
|
170 |
|
|
|
171 |
|
|
gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0 == 1"
|
172 |
|
|
gdb_test "info register st0" "st0 *1\t.*" "verify st0 == 1"
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
|