From: Michael Snyder <msnyder@vmware.com>
To: Hui Zhu <teawater@gmail.com>
Cc: paawan oza <paawan1982@yahoo.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Pedro Alves <pedro@codesourcery.com>
Subject: Re: i386.record.floating.point.patch : with more testing and assurity
Date: Mon, 13 Jul 2009 20:16:00 -0000 [thread overview]
Message-ID: <4A5B8D27.6040405@vmware.com> (raw)
In-Reply-To: <daef60380907122356i370e825ue810c1293cf174ea@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 213 bytes --]
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
[-- Attachment #2: i387.txt --]
[-- Type: text/plain, Size: 4161 bytes --]
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"
+
next prev parent reply other threads:[~2009-07-13 19:43 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 15:05 paawan oza
2009-07-01 5:53 ` Hui Zhu
2009-07-12 11:12 ` Michael Snyder
2009-07-12 17:47 ` paawan oza
2009-07-13 0:38 ` Michael Snyder
2009-07-13 17:03 ` Hui Zhu
2009-07-13 20:16 ` Michael Snyder [this message]
2009-07-15 9:21 ` Hui Zhu
2009-07-19 3:27 ` paawan oza
2009-07-18 23:36 ` paawan oza
[not found] <992589.56162.qm@web112513.mail.gq1.yahoo.com>
2009-07-26 19:10 ` Mark Kettenis
-- strict thread matches above, loose matches on Subject: below --
2009-07-26 14:27 paawan oza
2009-07-26 22:51 ` Michael Snyder
2009-07-27 1:09 ` Michael Snyder
2009-07-27 2:33 ` Samuel Bronson
2009-07-06 19:09 paawan oza
2009-07-06 19:05 paawan oza
2009-07-08 9:00 ` Hui Zhu
2009-07-12 9:52 ` Michael Snyder
2009-07-12 18:12 ` Michael Snyder
2009-07-06 19:03 paawan oza
2009-07-06 19:01 paawan oza
2009-07-04 5:19 paawan oza
2009-07-05 10:15 ` Hui Zhu
2009-07-03 18:55 paawan oza
2009-07-03 21:52 ` Michael Snyder
2009-07-02 7:40 paawan oza
2009-07-02 3:39 paawan oza
2009-07-02 3:34 paawan oza
2009-07-01 16:17 paawan oza
2009-07-05 18:33 ` Mark Kettenis
2009-07-01 16:02 paawan oza
2009-07-01 16:14 ` Mark Kettenis
2009-07-01 16:01 paawan oza
2009-07-01 15:59 paawan oza
2009-07-02 2:02 ` Hui Zhu
2009-06-30 13:23 paawan oza
2009-06-30 13:38 ` Pedro Alves
2009-06-30 13:42 ` Mark Kettenis
2009-06-04 14:50 paawan oza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A5B8D27.6040405@vmware.com \
--to=msnyder@vmware.com \
--cc=gdb-patches@sourceware.org \
--cc=paawan1982@yahoo.com \
--cc=pedro@codesourcery.com \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox