Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Kargov <kargov@gmail.com>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix the x87 FP register printout by “info float”.
Date: Fri, 19 Apr 2013 14:30:00 -0000	[thread overview]
Message-ID: <CAHLdKinQnJHBayS1va0aqrspfcwfO4iVJwNxuaof5VsHjObtuQ@mail.gmail.com> (raw)
In-Reply-To: <516FC7B3.4050502@redhat.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


  reply	other threads:[~2013-04-19  3:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 15:40 Vladimir Kargov
2013-04-19  9:43 ` Pedro Alves
2013-04-19 14:30   ` Vladimir Kargov [this message]
2013-04-19 14:33     ` Pedro Alves
2013-04-19 18:23       ` Vladimir Kargov

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=CAHLdKinQnJHBayS1va0aqrspfcwfO4iVJwNxuaof5VsHjObtuQ@mail.gmail.com \
    --to=kargov@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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