i386.record.floating.point.patch : with more testing and assurity
Hui Zhu
teawater@gmail.com
Wed Jul 15 09:21:00 GMT 2009
I try this test with fp insn patch. Everything is OK. Thanks.
BTW, I copy them to "src/gdb/testsuite/gdb.reverse". And use command
make check RUNTESTFLAGS="i387-float-reverse.exp --target_board=precord"
in testsuite directory.
Thanks,
Hui
On Tue, Jul 14, 2009 at 03:38, Michael Snyder<msnyder@vmware.com> wrote:
> Hui Zhu wrote:
>>
>> Could you post it in patch format? That will make me can try it directly.
>> :)
>>
>> Thanks,
>> Hui
>
>
> OK, but this is not intended as a submission.
> It's just an example or starting point.
>
> Michael
>
>
> diff -rNu gdb.tmp/i387-float-reverse.c gdb.arch/i387-float-reverse.c
> --- gdb.tmp/i387-float-reverse.c 1969-12-31 16:00:00.000000000 -0800
> +++ gdb.arch/i387-float-reverse.c 2009-07-11 17:16:56.000000000 -0700
> @@ -0,0 +1,30 @@
> +/* Reverse debugging of floating point registers.
> +
> + Copyright 2009, Free Software Foundation, Inc.
> +
> + This file is part of GDB.
> +
> + 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/>.
> */
> +
> +int main (void)
> +{
> + int i = 0; /* BEGIN I387-FLOAT-REVERSE */
> +
> + asm ("fldz"); /* test st0 register */
> + asm ("fld1");
> + asm ("nop");
> +
> + return i; /* END I387-FLOAT-REVERSE */
> +}
> +
> diff -rNu gdb.tmp/i387-float-reverse.exp gdb.arch/i387-float-reverse.exp
> --- gdb.tmp/i387-float-reverse.exp 1969-12-31 16:00:00.000000000 -0800
> +++ gdb.arch/i387-float-reverse.exp 2009-07-11 17:30:03.000000000 -0700
> @@ -0,0 +1,83 @@
> +# Copyright 2009 Free Software Foundation, Inc.
> +
> +# 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 $tracelevel {
> + strace $tracelevel
> +}
> +
> +set prms_id 0
> +set bug_id 0
> +
> +if ![istarget "i?86-*linux*"] then {
> + verbose "Skipping i387 reverse float tests."
> + return
> +}
> +
> +set testfile "i387-float-reverse"
> +set srcfile ${testfile}.c
> +set binfile ${objdir}/${subdir}/${testfile}
> +
> +# some targets have leading underscores on assembly symbols.
> +# TODO: detect this automatically
> +set additional_flags ""
> +if [istarget "i?86-*-cygwin*"] then {
> + set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
> +}
> +
> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable
> [list debug $additional_flags]] != "" } {
> + untested i387-float-reverse
> + return -1
> +}
> +
> +# Get things started.
> +
> +gdb_exit
> +gdb_start
> +gdb_reinitialize_dir $srcdir/$subdir
> +gdb_load ${binfile}
> +runto main
> +
> +# Record to end of main
> +
> +set location [gdb_get_line_number "END I387-FLOAT-REVERSE"]
> +gdb_test "record" "" "Turn on process record"
> +gdb_test "until $location" ".*/$srcfile:$location.*" \
> + "record to end of main"
> +
> +# Now rewind to beginning so we can begin testing.
> +
> +set location [gdb_get_line_number "BEGIN I387-FLOAT-REVERSE"]
> +gdb_test "set exec-dir reverse" "" "set reverse direction"
> +gdb_test "until $location" ".*/$srcfile:$location.*" \
> + "rewind to beginning of main"
> +gdb_test "set exec-dir forward" "" "set forward direction"
> +
> +# Test st0 register
> +
> +set location [gdb_get_line_number "test st0 register"]
> +gdb_test "until $location" ".*/$srcfile:$location.*asm.*fldz.*" \
> + "begin test st0"
> +gdb_test "stepi" "asm.*fld1.*" "set st0 == 0"
> +gdb_test "info register st0" "st0 *0\t.*" "verify st0 == 0"
> +gdb_test "stepi" "asm.*nop.*" "set st0 == 1"
> +gdb_test "info register st0" "st0 *1\t.*" "verify st0 == 1"
> +
> +# Now step backward, and check that st0 value reverts to zero.
> +
> +gdb_test "reverse-stepi" "asm.*fld1.*" "undo set st0 == 1"
> +gdb_test "info register st0" "st0 *0\t.*" "verify st0 == 0 again"
> +
>
>
More information about the Gdb-patches
mailing list