2015-01-01 09:32:14 +00:00
|
|
|
# Copyright 2009-2015 Free Software Foundation, Inc.
|
2009-12-10 19:36:20 +00: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-26 17:54:59 +00:00
|
|
|
standard_testfile
|
2009-12-10 19:36:20 +00:00
|
|
|
|
|
|
|
# some targets have leading underscores on assembly symbols.
|
2011-05-24 12:01:22 +00:00
|
|
|
set additional_flags [gdb_target_symbol_prefix_flags]
|
2009-12-10 19:36:20 +00:00
|
|
|
|
2012-06-26 17:54:59 +00:00
|
|
|
if {[prepare_for_testing $testfile.exp $testfile $srcfile \
|
|
|
|
[list debug $additional_flags]]} {
|
2009-12-10 19:36:20 +00:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
runto main
|
|
|
|
|
|
|
|
# Record to end of main
|
|
|
|
|
|
|
|
set location [gdb_get_line_number "END I387-FLOAT-REVERSE"]
|
2010-05-28 18:26:41 +00:00
|
|
|
gdb_test_no_output "record" "Turn on process record"
|
2011-11-10 19:22:07 +00:00
|
|
|
# This can take awhile.
|
|
|
|
set oldtimeout $timeout
|
|
|
|
set timeout [expr $oldtimeout + 120]
|
2014-10-17 14:28:17 +00:00
|
|
|
gdb_test "until $location" ".*$srcfile:$location.*" \
|
2009-12-10 19:36:20 +00:00
|
|
|
"record to end of main"
|
2011-11-10 19:22:07 +00:00
|
|
|
set timeout $oldtimeout
|
2009-12-10 19:36:20 +00:00
|
|
|
|
|
|
|
# Now rewind to beginning so we can begin testing.
|
|
|
|
|
|
|
|
set location [gdb_get_line_number "BEGIN I387-FLOAT-REVERSE"]
|
2010-05-28 18:26:41 +00:00
|
|
|
gdb_test_no_output "set exec-dir reverse" "set reverse direction"
|
2014-10-17 14:28:17 +00:00
|
|
|
gdb_test "until $location" ".*$srcfile:$location.*" \
|
2009-12-10 19:36:20 +00:00
|
|
|
"rewind to beginning of main"
|
2010-05-28 18:26:41 +00:00
|
|
|
gdb_test_no_output "set exec-dir forward" "set forward direction"
|
2009-12-10 19:36:20 +00:00
|
|
|
|
|
|
|
# Test FPU env particularly ftag and fstatus reigters.
|
|
|
|
|
|
|
|
set location [gdb_get_line_number "TEST ENV"]
|
2014-10-17 14:28:17 +00:00
|
|
|
gdb_test "until $location" ".*$srcfile:$location.*asm.*nop.*" \
|
2009-12-10 19:36:20 +00:00
|
|
|
"begin testing fpu env"
|
|
|
|
|
|
|
|
gdb_test "n" "asm.*fsave.*" "save FPU env in memory"
|
|
|
|
gdb_test "n" "asm.*frstor.*" "restore FPU env"
|
|
|
|
gdb_test "n" "asm.*fstsw.*" "store status word in EAX"
|
|
|
|
gdb_test "n" "asm.*fld1.*" "push st0"
|
|
|
|
|
|
|
|
gdb_test "info register eax" "eax *0x8040000.*\t.*" "verify eax == 0x8040000"
|
|
|
|
gdb_test "info register fstat" "fstat *0.*\t.*" "verify fstat == 0"
|
|
|
|
gdb_test "info register ftag" "ftag *0xffff.*\t.*" "verify ftag == 0xffff"
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldl2t.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x3800.*\t.*" "verify fstat == 0x3800"
|
|
|
|
gdb_test "info register ftag" "ftag *0x3fff.*\t.*" "verify ftag == 0x3fff"
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldl2e.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x3000.*\t.*" "verify fstat == 0x3000"
|
|
|
|
gdb_test "info register ftag" "ftag *0xfff.*\t.*" "verify ftag == 0xfff"
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldpi.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x2800.*\t.*" "verify fstat == 0x2800"
|
|
|
|
gdb_test "info register ftag" "ftag *0x3ff.*\t.*" "verify ftag == 0x3ff"
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldlg2.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x2000.*\t.*" "verify fstat == 0x2000"
|
|
|
|
gdb_test "info register ftag" "ftag *0xff.*\t.*" "verify ftag == 0xff"
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldln2.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x1800.*\t.*" "verify fstat == 0x1800"
|
|
|
|
gdb_test "info register ftag" "ftag *0x3f.*\t.*" "verify ftag == 0x3f"
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*fldz.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x1000.*\t.*" "verify fstat == 0x1000"
|
|
|
|
gdb_test "info register ftag" "ftag *0xf.*\t.*" "verify ftag == 0xf"
|
|
|
|
|
|
|
|
gdb_test "stepi" "asm.*nop.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x800.*\t.*" "verify fstat == 0x800"
|
|
|
|
gdb_test "info register ftag" "ftag *0x7.*\t.*" "verify ftag == 0x7"
|
|
|
|
|
|
|
|
|
|
|
|
# move backward and ehck we get the same registers back.
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldz.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x1000.*\t.*" "verify fstat == 0x1000"
|
|
|
|
gdb_test "info register ftag" "ftag *0xf.*\t.*" "verify ftag == 0xf"
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x1800.*\t.*" "verify fstat == 0x1800"
|
|
|
|
gdb_test "info register ftag" "ftag *0x3f.*\t.*" "verify ftag == 0x3f"
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x2000.*\t.*" "verify fstat == 0x2000"
|
|
|
|
gdb_test "info register ftag" "ftag *0xff.*\t.*" "verify ftag == 0xff"
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x2800.*\t.*" "verify fstat == 0x2800"
|
|
|
|
gdb_test "info register ftag" "ftag *0x3ff.*\t.*" "verify ftag == 0x3ff"
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x3000.*\t.*" "verify fstat == 0x3000"
|
|
|
|
gdb_test "info register ftag" "ftag *0xfff.*\t.*" "verify ftag == 0xfff"
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0x3800.*\t.*" "verify fstat == 0x3800"
|
|
|
|
gdb_test "info register ftag" "ftag *0x3fff.*\t.*" "verify ftag == 0x3fff"
|
|
|
|
|
|
|
|
gdb_test "reverse-stepi" "asm.*fld1.*" "push st0"
|
|
|
|
gdb_test "info register fstat" "fstat *0.*\t.*" "verify fstat == 0"
|
|
|
|
gdb_test "info register ftag" "ftag *0xffff.*\t.*" "verify ftag == 0xffff"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|