This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix the x87 FP register printout by “info float”.
- From: Vladimir Kargov <kargov at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>, gdb-patches at sourceware dot org
- Date: Fri, 19 Apr 2013 07:22:34 +0400
- Subject: Re: [PATCH] Fix the x87 FP register printout by “info float”.
- References: <CAHLdKi=qPX-x7Eb0gwqTaOsWp0gK0=3WQFLmc6_HBKGUZ7RzfQ at mail dot gmail dot com> <516FC7B3 dot 4050502 at redhat dot com>
On 18 April 2013 14:15, Pedro Alves <palves@redhat.com> wrote:
> On 04/18/2013 01:51 AM, Vladimir Kargov wrote:
>
>> Another way to fix this would be to replace the type in the definition
>> of variable "raw" from "char" to "gdb_char" which is currently defined
>> as "unsigned char",
>
> You must have meant gdb_byte.
Yes, sure.
> Actually, this (not checked in yet) series does that:
Oh, I did not notice it. It should solve the problem, although I think
it is still reasonable to add the length modifier to fprintf_filtered
in case the definition of gdb_byte ever changes.
>> but I couldn't find any signs in the code that
>> this typedef wouldn't be changed in the future to something else.
>
> Could you write a test case? That'd prevent a regression here
> going unnoticed.
A testcase for the proper FP register printout? I'm attaching one.
(may have missed some formatting/guidelines...)
2013-04-19 Vladimir Kargov <kargov@gmail.com>
* gdb.arch/i386-float.S: New file.
* gdb.arch/i386-float.exp: New file.
diff --git a/gdb/testsuite/gdb.arch/i386-float.S
b/gdb/testsuite/gdb.arch/i386-float.S
new file mode 100644
index 0000000..f7c87f8
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-float.S
@@ -0,0 +1,24 @@
+/* Copyright 2009-2013 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. */
+
+ .text
+ .globl main
+main:
+ fninit
+ fldt val
+.data
+ val: .byte 0x00,0x00,0x45,0x07,0x11,0x19,0x22,0xe9,0xfe,0xbf
diff --git a/gdb/testsuite/gdb.arch/i386-float.exp
b/gdb/testsuite/gdb.arch/i386-float.exp
new file mode 100644
index 0000000..a50f608
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-float.exp
@@ -0,0 +1,51 @@
+# Copyright (C) 2009-2013 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.
+
+# Test the x87 floating point information printout.
+
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
+ verbose "Skipping i386 test for proper x87 FP support."
+ return
+}
+
+set testfile "i386-float"
+set srcfile ${testfile}.S
+set binfile ${objdir}/${subdir}/${testfile}
+
+# some targets have leading underscores on assembly symbols.
+set additional_flags [gdb_target_symbol_prefix_flags]
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}"
executable [list debug $additional_flags]] != "" } {
+ untested i386-float.exp
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+}
+
+send_gdb "stepi\n"
+gdb_test "info float" ".*R7: Empty 0x00000000000000000000\r\n.*"
+send_gdb "stepi\n"
+gdb_test "info float" ".*=>R7: Valid 0xbffee922191107450000 .*"
--
Vladimir