2018-01-01 12:43:02 +08:00
|
|
|
# Copyright 2009-2018 Free Software Foundation, Inc.
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# This file is part of the gdb testsuite.
|
|
|
|
|
|
|
|
|
|
|
|
if ![istarget "i?86-*linux*"] then {
|
|
|
|
verbose "Skipping i387 reverse float tests."
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2012-06-27 01:54:59 +08:00
|
|
|
standard_testfile
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
# some targets have leading underscores on assembly symbols.
|
2011-05-24 20:01:22 +08:00
|
|
|
set additional_flags [gdb_target_symbol_prefix_flags]
|
2009-12-11 03:36:20 +08:00
|
|
|
|
2016-12-24 00:52:18 +08:00
|
|
|
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
|
2012-06-27 01:54:59 +08:00
|
|
|
[list debug $additional_flags]]} {
|
2009-12-11 03:36:20 +08:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
runto main
|
|
|
|
|
|
|
|
# Record to end of main
|
|
|
|
|
|
|
|
set location [gdb_get_line_number "END I387-FLOAT-REVERSE"]
|
2016-12-02 04:42:48 +08:00
|
|
|
gdb_test_no_output "record" "turn on process record"
|
2014-10-17 22:28:17 +08:00
|
|
|
gdb_test "until $location" ".*$srcfile:$location.*" \
|
2009-12-11 03:36:20 +08:00
|
|
|
"record to end of main"
|
|
|
|
|
|
|
|
# Now rewind to beginning so we can begin testing.
|
|
|
|
|
|
|
|
set location [gdb_get_line_number "BEGIN I387-FLOAT-REVERSE"]
|
2010-05-29 02:26:41 +08:00
|
|
|
gdb_test_no_output "set exec-dir reverse" "set reverse direction"
|
2014-10-17 22:28:17 +08:00
|
|
|
gdb_test "until $location" ".*$srcfile:$location.*" \
|
2009-12-11 03:36:20 +08:00
|
|
|
"rewind to beginning of main"
|
2010-05-29 02:26:41 +08:00
|
|
|
gdb_test_no_output "set exec-dir forward" "set forward direction"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
# Test FPU stack. FPU stack includes st0, st1, st2, st3, st4,
|
|
|
|
# st5, st6, st7. We push 8 values to FPU stack in record mode
|
|
|
|
# and see whether all are getting recorded.
|
|
|
|
|
|
|
|
set location [gdb_get_line_number "test st0 register"]
|
2014-10-17 22:28:17 +08:00
|
|
|
gdb_test "until $location" ".*$srcfile:$location.*asm.*fld1.*" \
|
2009-12-11 03:36:20 +08:00
|
|
|
"begin test st0"
|
|
|
|
gdb_test "stepi" "asm.*fldl2t.*" "push st0 == 1"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.321928094*"
|
|
|
|
gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldpi.*" "push st0 == 1.4426950406*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
|
|
|
|
gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
|
|
|
|
gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
|
|
|
|
gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.4426950*"
|
|
|
|
gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280*"
|
|
|
|
gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
|
|
|
|
gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
|
|
|
|
gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.44269506*"
|
|
|
|
gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
|
|
|
|
gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
|
|
|
|
gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
|
|
|
|
gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
|
|
|
|
gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
|
|
|
|
gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
|
|
|
|
gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fld1.*" "push st0 == 0"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0"
|
|
|
|
gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
|
|
|
|
gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
|
|
|
|
gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
|
|
|
|
gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
|
|
|
|
gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.32192809*"
|
|
|
|
gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*nop.*" "push st0 == 0"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
|
|
|
gdb_test "info register st1" "st1 *0\[ \t\]+.*" "verify st1 == 0"
|
|
|
|
gdb_test "info register st2" "st2 *0.69314.*\[ \t\]+.*" "verify st2 == 0.69314*"
|
|
|
|
gdb_test "info register st3" "st3 *0.30102.*\[ \t\]+.*" "verify st3 == 0.301029*"
|
|
|
|
gdb_test "info register st4" "st4 *3.14159.*\[ \t\]+.*" "verify st4 == 3.14159265*"
|
|
|
|
gdb_test "info register st5" "st5 *1.44269.*\[ \t\]+.*" "verify st5 == 1.44269504*"
|
|
|
|
gdb_test "info register st6" "st6 *3.32192.*\[ \t\]+.*" "verify st6 == 3.3219280948*"
|
2009-12-11 03:36:20 +08:00
|
|
|
gdb_test "info register st7" "st7 *1.*" "verify st7 == 1"
|
|
|
|
|
|
|
|
# Now step backward, and check that st0 value reverts to zero.
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fld1.*" "undo registers, st0-st7"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0"
|
|
|
|
gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
|
|
|
|
gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
|
|
|
|
gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
|
|
|
|
gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
|
|
|
|
gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.3219280948*"
|
|
|
|
gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
|
|
|
|
gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
|
|
|
|
gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
|
|
|
|
gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
|
|
|
|
gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
|
|
|
|
gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
|
|
|
|
gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
|
|
|
|
gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.442695040*"
|
|
|
|
gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
|
|
|
|
gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
|
|
|
|
gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.442695040*"
|
|
|
|
gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280948*"
|
|
|
|
gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0 == 1.44269504088*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
|
|
|
|
gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
|
|
|
|
gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.3219280948*"
|
|
|
|
gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0 == 1"
|
2018-01-08 05:59:13 +08:00
|
|
|
gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
2009-12-11 03:36:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|