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