Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael <gdb-patches@cyberfiber.org>
To: gdb-patches@sourceware.org
Subject: Re: [RFA/i387] improve the output of 'info float'
Date: Sun, 03 Jan 2010 10:52:00 -0000	[thread overview]
Message-ID: <4B4076CE.9090000@cyberfiber.org> (raw)
In-Reply-To: <201001030845.o038jrhH012796@glazunov.sibelius.xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

Hi all,

Hope this does a better job then. I also removed the typo's from the 
comments.

Mark Kettenis wrote:
>> Date: Sun, 3 Jan 2010 09:32:13 +0400
>> From: Joel Brobecker <brobecker@adacore.com>
>>
>> Michael,
>>
>> I changed the subject to something meaningful; you have a *much* higher
>> chance of attracting the eye of the appropriate maintainer if you use
>> descriptive subjects.
>>     
>
> Yup.  I didn't notice it.  So either I didn't receive the origional
> mail or I deleted it immediately based on the subject.  Can you send
> the diff again?
>
>   
>> I will let Mark tell you whether he likes your change of output or not.
>> Personally, I liked the previous output better - much more compact
>> and easier to read, there are too many decorations in your proposed
>> output and it's harder to isolate the relevant information.
>>     
>
> If you send your diff again, can you include an example of how the
> output looks?  I must warn you that I'm likely to agree with Joel here
> though.
>
>   
New output looks like:

Does not display correctly in the previous email, you should check it 
for yourself I suppose.

Regards,
Michael


[-- Attachment #2: gdb.diff --]
[-- Type: text/x-patch, Size: 6766 bytes --]

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 188347f..d747e79 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-02  Michael Baars  <development@codenamezero.org>
+
+	* i387-tdep.c:
+	    (print_i387_status_word): Adapted the output such that the least 
+	      significant bits appear at the right and added a more 
+	      comprehensive description of the flags involved.
+	    (print_i387_control_word): Adapted the output such that the least
+	      significant bits appear at the right.
+	    
+	    naming conventions are conform the intel i387 dx programmer's 
+	    reference manual (1989)
+
 2010-01-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* cli/cli-script.c (process_next_line): Rename p1 as p_end and p2 as
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 3fb5b56..e5766d7 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -113,86 +113,106 @@ print_i387_ext (struct gdbarch *gdbarch,
     fputs_filtered (" Unsupported", file);
 }
 
-/* Print the status word STATUS.  */
-
+/* Print the status word. */
 static void
 print_i387_status_word (unsigned int status, struct ui_file *file)
 {
-  fprintf_filtered (file, "Status Word:         %s",
-		    hex_string_custom (status, 4));
-  fputs_filtered ("  ", file);
-  fprintf_filtered (file, " %s", (status & 0x0001) ? "IE" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x0002) ? "DE" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x0004) ? "ZE" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x0008) ? "OE" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x0010) ? "UE" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x0020) ? "PE" : "  ");
-  fputs_filtered ("  ", file);
-  fprintf_filtered (file, " %s", (status & 0x0080) ? "ES" : "  ");
-  fputs_filtered ("  ", file);
-  fprintf_filtered (file, " %s", (status & 0x0040) ? "SF" : "  ");
-  fputs_filtered ("  ", file);
-  fprintf_filtered (file, " %s", (status & 0x0100) ? "C0" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x0200) ? "C1" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x0400) ? "C2" : "  ");
-  fprintf_filtered (file, " %s", (status & 0x4000) ? "C3" : "  ");
-
-  fputs_filtered ("\n", file);
-
-  fprintf_filtered (file,
-		    "                       TOP: %d\n", ((status >> 11) & 7));
+  fprintf_filtered (file, "status word              : %s\n",
+    hex_string_custom(status, 4));
+
+  fprintf_filtered (file, "  exception flags        : ");
+
+  /* Precision */
+  fprintf_filtered (file, "%s ", (status & 0x0020) ? "PE" : "  ");
+  /* Underflow */
+  fprintf_filtered (file, "%s ", (status & 0x0010) ? "UE" : "  ");
+  /* Overflow */
+  fprintf_filtered (file, "%s ", (status & 0x0008) ? "OE" : "  ");
+  /* Zero Devide */
+  fprintf_filtered (file, "%s ", (status & 0x0004) ? "ZE" : "  ");
+  /* Denormalized operand */
+  fprintf_filtered (file, "%s ", (status & 0x0002) ? "DE" : "  ");
+  /* Invalid operation */
+  fprintf_filtered (file, "%s ", (status & 0x0001) ? "IE" : "  ");
+
+  fprintf_filtered (file, "\n");
+
+  fprintf_filtered (file, "  stack fault            : %s\n",
+    (status & 0x0040) ? "SF" : "  ");
+  fprintf_filtered (file, "  error summary status   : %s\n",
+    (status & 0x0080) ? "ES" : "  ");
+
+  fprintf_filtered (file, "  condition code         : ");
+
+  fprintf_filtered (file, "%s ", (status & 0x4000) ? "C3" : "  ");
+  fprintf_filtered (file, "%s ", (status & 0x0400) ? "C2" : "  ");
+  fprintf_filtered (file, "%s ", (status & 0x0200) ? "C1" : "  ");
+  fprintf_filtered (file, "%s ", (status & 0x0100) ? "C0" : "  ");
+  fprintf_filtered (file, "\n");
+
+  fprintf_filtered (file, "  top of stack (TOP)     : %d\n",
+    ((status >> 11) & 7));
 }
 
-/* Print the control word CONTROL.  */
-
+/* Print the control word. */
 static void
 print_i387_control_word (unsigned int control, struct ui_file *file)
 {
-  fprintf_filtered (file, "Control Word:        %s",
-		    hex_string_custom (control, 4));
-  fputs_filtered ("  ", file);
-  fprintf_filtered (file, " %s", (control & 0x0001) ? "IM" : "  ");
-  fprintf_filtered (file, " %s", (control & 0x0002) ? "DM" : "  ");
-  fprintf_filtered (file, " %s", (control & 0x0004) ? "ZM" : "  ");
-  fprintf_filtered (file, " %s", (control & 0x0008) ? "OM" : "  ");
-  fprintf_filtered (file, " %s", (control & 0x0010) ? "UM" : "  ");
-  fprintf_filtered (file, " %s", (control & 0x0020) ? "PM" : "  ");
+  fprintf_filtered(file, "control word             : %s\n",
+    hex_string_custom(control, 4));
 
-  fputs_filtered ("\n", file);
+  fprintf_filtered(file, "  exception masks        : ");
+
+  /* Precision */
+  fprintf_filtered (file, "%s ", (control & 0x0020) ? "PM" : "  ");
+  /* Underflow */
+  fprintf_filtered (file, "%s ", (control & 0x0010) ? "UM" : "  ");
+  /* Overflow */
+  fprintf_filtered (file, "%s ", (control & 0x0008) ? "OM" : "  ");
+  /* Zero devide */
+  fprintf_filtered (file, "%s ", (control & 0x0004) ? "ZM" : "  ");
+  /* Denormalized operand */
+  fprintf_filtered (file, "%s ", (control & 0x0002) ? "DM" : "  ");
+  /* Invalid operation */
+  fprintf_filtered (file, "%s ", (control & 0x0001) ? "IM" : "  ");
+
+  fprintf_filtered (file, "\n");
+
+  fprintf_filtered (file, "  precision control (PC) : ");
 
-  fputs_filtered ("                       PC: ", file);
   switch ((control >> 8) & 3)
-    {
+  {
     case 0:
-      fputs_filtered ("Single Precision (24-bits)\n", file);
+      fprintf_filtered (file, "24-bits (single precision)\n");
       break;
     case 1:
-      fputs_filtered ("Reserved\n", file);
+      fprintf_filtered (file, "(reserved)\n");
       break;
     case 2:
-      fputs_filtered ("Double Precision (53-bits)\n", file);
+      fprintf_filtered (file, "53-bits (double precision)\n");
       break;
     case 3:
-      fputs_filtered ("Extended Precision (64-bits)\n", file);
+      fprintf_filtered (file, "64-bits (extended precision)\n");
       break;
-    }
-      
-  fputs_filtered ("                       RC: ", file);
+  }
+
+  fprintf_filtered (file, "  rounding control (RC)  : ");
+
   switch ((control >> 10) & 3)
-    {
+  {
     case 0:
-      fputs_filtered ("Round to nearest\n", file);
+      fprintf_filtered (file, "round to nearest or even\n");
       break;
     case 1:
-      fputs_filtered ("Round down\n", file);
+      fprintf_filtered (file, "round down (towards -inf)\n");
       break;
     case 2:
-      fputs_filtered ("Round up\n", file);
+      fprintf_filtered (file, "round up (toward +inf)\n");
       break;
     case 3:
-      fputs_filtered ("Round toward zero\n", file);
+      fprintf_filtered (file, "chop (truncate toward zero)\n");
       break;
-    }
+  }
 }
 
 /* Print out the i387 floating point state.  Note that we ignore FRAME


  parent reply	other threads:[~2010-01-03 10:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4B3E4DC6.7020901@cyberfiber.org>
     [not found] ` <20100102043704.GR548@adacore.com>
2010-01-02  8:29   ` gdb-patch mailing list Michael
2010-01-02  8:48     ` Michael
     [not found]       ` <20100102093213.GX2788@adacore.com>
2010-01-02  9:33         ` Joel Brobecker
     [not found]           ` <4B3F252A.30504@cyberfiber.org>
     [not found]             ` <20100102111708.GV548@adacore.com>
2010-01-02 11:56               ` Michael
2010-01-03  5:32                 ` [RFA/i387] improve the output of 'info float' (was: "Re: gdb-patch mailing list") Joel Brobecker
2010-01-03  8:46                   ` Mark Kettenis
2010-01-03 10:47                     ` [RFA/i387] improve the output of 'info float' Michael
2010-01-03 10:52                     ` Michael [this message]
2010-01-04 18:47                     ` Michael
2010-01-03 10:46                   ` [RFA/i387] improve the output of 'info float' (was: "Re: gdb-patch mailing list") Eli Zaretskii

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=4B4076CE.9090000@cyberfiber.org \
    --to=gdb-patches@cyberfiber.org \
    --cc=gdb-patches@sourceware.org \
    /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