From: "Baars, M.J." <mjbaars1977.gdb@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb@sourceware.org, gdb-patches@sourceware.org,
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject: Re: print_npx_status_word
Date: Tue, 19 Apr 2011 19:01:00 -0000 [thread overview]
Message-ID: <4DADDBE2.8050704@gmail.com> (raw)
In-Reply-To: <m3liz78pak.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]
On 04/18/2011 07:03 PM, Tom Tromey wrote:
>>>>>> "Michael" == Baars, M J<mjbaars1977.gdb@gmail.com> writes:
Hi Tom,
Thank you for your reply, for your convenience I attached a slightly
different version already.
> Michael> Oops... did I remove one of your entries in the ChangeLog? :)
>
> As others have noted, ChangeLog is "prepend only".
> We generally don't edit old entries.
As I stated before, it would be unwise though to keep unmaintained
function names in the log entries. You can apply the changes optionally,
but I strongly advise against retaining the original log entries.
> Michael> +struct
> Michael> +{
> Michael> + char *tag;
> Michael> + char *description;
> Michael> +}
>
> Wrong indentation here, should be 2 spaces.
> Fields should have descriptive comments.
> I think the struct should have a tag and be terminated here.
> Also the fields should be "const".
Here you are completely right, I added the 'const' operators. If you
don't like the indentation, I suggest you instead modify you
tab-settings locally. Personally I'm used programming with a little more
space than.
> Michael> +static const npx_exception_flags[6] =
> Michael> +
> Michael> +{
> Michael> + {"IE", "invalid operation"},
>
> Wrong indentation. This is a problem in the whole patch.
>
> Michael> +// print the numeric coprocessor extension (npx) status word
>
> No `//' comments.
I have taken this into account, does that also hold for inline comments?
> Comments should be full sentences, see GNU standards.
>
> Michael> +void print_npx_status_word(uint16_t npx_status_word, struct ui_file *file)
>
> Newline after "void".
> Space before "(" -- a problem in a few spots.
> Again, GNU standards.
Hope you'll make an exception here, I like the code better this way :)
> Tom
Regards,
Michael.
[-- Attachment #2: ChangeLog.diff --]
[-- Type: text/x-patch, Size: 498 bytes --]
--- ./gdb-7.2/gdb/ChangeLog 2010-09-03 01:37:25.000000000 +0200
+++ ./gdb-7.2.2/gdb/ChangeLog 2011-04-16 22:56:35.359736001 +0200
@@ -1,3 +1,11 @@
+2011-04-16 Ir. M.J. Baars <mjbaars1977.gdb@gmail.com>
+
+ * i387-tdep.c (print_npx_control_word) - new function
+
+2011-04-14 Ir. M.J. Baars <mjbaars1977.gdb@gmail.com>
+
+ * i387-tdep.c (print_npx_status_word) - new function
+
2010-09-02 Joel Brobecker <brobecker@adacore.com>
* NEWS: Replace "Changes since GDB 7.1" by "Changes in GDB 7.2".
[-- Attachment #3: ChangeLog-1999.diff --]
[-- Type: text/x-patch, Size: 678 bytes --]
--- ./gdb-7.2/gdb/ChangeLog-1999 2001-01-12 04:44:31.000000000 +0100
+++ ./gdb-7.2.2/gdb/ChangeLog-1999 2011-04-16 22:53:25.543736000 +0200
@@ -581,9 +581,9 @@ Wed Dec 8 15:29:48 1999 Andrew Cagney
Patch from Mark Kettenis <kettenis@gnu.org>:
* config/i386/tm-i386.h (FLOAT_INFO): New define.
- * i387-tdep.c (print_i387_value, print_i387_ext,
- print_i387_status_word, print_i387_control_word, i387_float_info):
- New functions, used to implement generic `info float' command.
+
+ * i387-tdep.c (print_i387_value,print_i387_ext,i387_float_info):
+ New functions, used to implement generic `info float' command.
1999-12-06 Christopher Faylor <cgf@cygnus.com>
[-- Attachment #4: ChangeLog-2001.diff --]
[-- Type: text/x-patch, Size: 557 bytes --]
--- ./gdb-7.2/gdb/ChangeLog-2001 2002-01-06 05:37:53.000000000 +0100
+++ ./gdb-7.2.2/gdb/ChangeLog-2001 2011-04-14 15:55:22.631948002 +0200
@@ -8076,11 +8076,6 @@ Wed Apr 4 21:48:42 2001 Christopher Fa
* MAINTAINERS: Add myself to write after approval list.
-2001-03-09 Mark Kettenis <kettenis@gnu.org>
-
- * i387-tdep.c (print_i387_status_word): Fix printing of Stack
- fault flag. It is bit 6 of the x87 FPU status word, not bit 7.
-
2001-03-08 Andrew Cagney <ac131313@redhat.com>
* configure.host (m88*-harris-cxux*): Mark as obsolete.
[-- Attachment #5: ChangeLog-2002.diff --]
[-- Type: text/x-patch, Size: 1057 bytes --]
--- ./gdb-7.2/gdb/ChangeLog-2002 2004-04-24 00:15:17.000000000 +0200
+++ ./gdb-7.2.2/gdb/ChangeLog-2002 2011-04-16 22:54:05.451736001 +0200
@@ -5396,12 +5396,14 @@ Fri Sep 13 07:42:09 2002 Andrew Cagney
* config/i386/tm-i386.h: Don't include "regcache.h".
* i387-tdep.h (i387_print_float_info): New prototype.
- * i387-tdep.c (print_i387_value, print_i387_ext,
- print_i387_status_word, print_i387_control_word): Add `struct
- ui_file *' argument and use it for output.
- (i387_print_float_info): Renamed from i387_float_info. Add
- `struct gdbarch *' and `struct ui_file *' arguments and use the
- latter for output.
+
+ * i387-tdep.c (print_i387_value,print_i387_ext):
+ Add `struct ui_file *' argument and use it for output.
+
+ * i387-tdep.c (i387_print_float_info):
+ Renamed from i387_float_info. Add `struct gdbarch *' and `struct ui_file *' arguments
+ and use the latter for output.
+
* i386-tdep.c: Include "i387-tdep.h".
(i386_gdbarch_init): Set print_float_info.
* config/i386/tm-i386.h (i387_float_info): Remove prototype.
[-- Attachment #6: ChangeLog-2004.diff --]
[-- Type: text/x-patch, Size: 628 bytes --]
--- ./gdb-7.2/gdb/ChangeLog-2004 2006-10-24 22:23:56.000000000 +0200
+++ ./gdb-7.2.2/gdb/ChangeLog-2004 2011-04-16 22:54:31.555736002 +0200
@@ -3468,9 +3468,9 @@
* ui-out.c (ui_out_field_core_addr): Ditto.
* breakpoint.c (breakpoint_adjustment_warning): Ditto.
* exec.c (print_section_info): Ditto.
- * i387-tdep.c (print_i387_status_word): Ditto.
- (print_i387_control_word): Ditto.
- (i387_print_float_info): Ditto.
+
+ * i387-tdep.c (i387_print_float_info): Ditto.
+
* maint.c (maint_print_section_info): Ditto.
* solib.c (info_sharedlibrary_command): Ditto.
* somsolib.c (som_sharedlibrary_info_command): Ditto.
[-- Attachment #7: i387-tdep.c.diff --]
[-- Type: text/x-patch, Size: 8147 bytes --]
--- ./gdb-7.2/gdb/i387-tdep.c 2010-05-05 21:30:36.000000000 +0200
+++ ./gdb-7.2.2/gdb/i387-tdep.c 2011-04-19 20:42:56.691027998 +0200
@@ -36,6 +36,106 @@
#include "i387-tdep.h"
#include "i386-xstate.h"
+struct
+{
+ const char *tag;
+ const char *description;
+}
+
+static const npx_exception_flags[6] =
+
+{
+ {"IE", "invalid operation"},
+ {"DE", "denormalized operand"},
+ {"ZE", "zero divide"},
+ {"OE", "overflow"},
+ {"UE", "underflow"},
+ {"PE", "precision"}
+};
+
+struct
+{
+ const char *tag;
+ const char *description;
+}
+
+static const npx_exception_mask[6] =
+
+{
+ {"IM", "invalid operation"},
+ {"DM", "denormalized operand"},
+ {"ZM", "zero divide"},
+ {"OM", "overflow"},
+ {"UM", "underflow"},
+ {"PM", "precision"}
+};
+
+static const char *npx_precision_control[4] =
+{
+ "24-bits (single precision)",
+ "(reserved)",
+ "53-bits (double precision)",
+ "64-bits (extended precision)"
+};
+
+static const char *npx_rounding_control[4] =
+{
+ "round to nearest or even",
+ "round down (towards -inf)",
+ "round up (toward +inf)",
+ "chop (truncate toward zero)"
+};
+
+/* print the numeric coprocessor extension (npx) status word */
+void print_npx_status_word(uint16_t npx_status_word, struct ui_file *file)
+{
+ fprintf_filtered(file, "status word : 0x%04X\n", npx_status_word);
+
+ fprintf_filtered(file, " exception flags : ");
+
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0005) & 0x0001) ? npx_exception_flags[5].tag : " "); // precision
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0004) & 0x0001) ? npx_exception_flags[4].tag : " "); // underflow
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0003) & 0x0001) ? npx_exception_flags[3].tag : " "); // overflow
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0002) & 0x0001) ? npx_exception_flags[2].tag : " "); // zero divide
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0001) & 0x0001) ? npx_exception_flags[1].tag : " "); // denormalized operand
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0000) & 0x0001) ? npx_exception_flags[0].tag : " "); // invalid operation
+ fprintf_filtered(file, "\n");
+
+ fprintf_filtered(file, " stack fault : %u\n", ((npx_status_word >> 0x0006) & 0x0001));
+ fprintf_filtered(file, " error summary status : %u\n", ((npx_status_word >> 0x0007) & 0x0001));
+ fprintf_filtered(file, " busy : %u\n", ((npx_status_word >> 0x000F) & 0x0001));
+ fprintf_filtered(file, " top of stack pointer : %u\n", ((npx_status_word >> 0x000B) & 0x0007));
+
+ fprintf_filtered(file, " condition code : ");
+
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x000E) & 0x0001) ? "C3" : " ");
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x000A) & 0x0001) ? "C2" : " ");
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0009) & 0x0001) ? "C1" : " ");
+ fprintf_filtered(file, "%s ", ((npx_status_word >> 0x0008) & 0x0001) ? "C0" : " ");
+ fprintf_filtered(file, "\n");
+}
+
+/* print the numeric coprocessor extension (npx) control word */
+void print_npx_control_word(uint16_t npx_control_word, struct ui_file *file)
+{
+ fprintf_filtered(file, "control word : 0x%04X\n", npx_control_word);
+
+ fprintf_filtered(file, " exception mask : ");
+
+ fprintf_filtered(file, "%s ", ((npx_control_word >> 0x0005) & 0x0001) ? npx_exception_mask[5].tag : " "); // precision
+ fprintf_filtered(file, "%s ", ((npx_control_word >> 0x0004) & 0x0001) ? npx_exception_mask[4].tag : " "); // underflow
+ fprintf_filtered(file, "%s ", ((npx_control_word >> 0x0003) & 0x0001) ? npx_exception_mask[3].tag : " "); // overflow
+ fprintf_filtered(file, "%s ", ((npx_control_word >> 0x0002) & 0x0001) ? npx_exception_mask[2].tag : " "); // zero divide
+ fprintf_filtered(file, "%s ", ((npx_control_word >> 0x0001) & 0x0001) ? npx_exception_mask[1].tag : " "); // denormalized operand
+ fprintf_filtered(file, "%s ", ((npx_control_word >> 0x0000) & 0x0001) ? npx_exception_mask[0].tag : " "); // invalid operation
+ fprintf_filtered(file, "\n");
+
+ fprintf_filtered(file, " precision control (PC) : %s\n", npx_precision_control[((npx_control_word >> 0x0008) & 0x0003)]);
+ fprintf_filtered(file, " rounding control (RC) : %s\n", npx_rounding_control[((npx_control_word >> 0x000A) & 0x0003)]);
+
+ fprintf_filtered(file, " infinity control : %u\n", ((npx_control_word >> 0x000C) & 0x0001));
+}
+
/* Print the floating point number specified by RAW. */
static void
@@ -114,88 +214,6 @@ print_i387_ext (struct gdbarch *gdbarch,
fputs_filtered (" Unsupported", file);
}
-/* Print the status word STATUS. */
-
-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));
-}
-
-/* Print the control word CONTROL. */
-
-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" : " ");
-
- fputs_filtered ("\n", file);
-
- fputs_filtered (" PC: ", file);
- switch ((control >> 8) & 3)
- {
- case 0:
- fputs_filtered ("Single Precision (24-bits)\n", file);
- break;
- case 1:
- fputs_filtered ("Reserved\n", file);
- break;
- case 2:
- fputs_filtered ("Double Precision (53-bits)\n", file);
- break;
- case 3:
- fputs_filtered ("Extended Precision (64-bits)\n", file);
- break;
- }
-
- fputs_filtered (" RC: ", file);
- switch ((control >> 10) & 3)
- {
- case 0:
- fputs_filtered ("Round to nearest\n", file);
- break;
- case 1:
- fputs_filtered ("Round down\n", file);
- break;
- case 2:
- fputs_filtered ("Round up\n", file);
- break;
- case 3:
- fputs_filtered ("Round toward zero\n", file);
- break;
- }
-}
-
/* Print out the i387 floating point state. Note that we ignore FRAME
in the code below. That's OK since floating-point registers are
never saved on the stack. */
@@ -268,8 +286,12 @@ i387_print_float_info (struct gdbarch *g
fputs_filtered ("\n", file);
- print_i387_status_word (fstat, file);
- print_i387_control_word (fctrl, file);
+ print_npx_status_word(fstat, file);
+ fprintf_filtered(file, "\n");
+
+ print_npx_control_word(fctrl, file);
+ fprintf_filtered(file, "\n");
+
fprintf_filtered (file, "Tag Word: %s\n",
hex_string_custom (ftag, 4));
fprintf_filtered (file, "Instruction Pointer: %s:",
next prev parent reply other threads:[~2011-04-19 19:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4DA7166F.10302@gmail.com>
[not found] ` <m3aafshl6l.fsf@fleche.redhat.com>
[not found] ` <4DA7ED79.3000400@gmail.com>
[not found] ` <m3ei53efd8.fsf@fleche.redhat.com>
[not found] ` <4DA87235.7060003@gmail.com>
[not found] ` <m3pqoncw78.fsf@fleche.redhat.com>
[not found] ` <4DA87479.50203@gmail.com>
[not found] ` <m3lizbcvt7.fsf@fleche.redhat.com>
2011-04-16 6:09 ` print_npx_status_word Baars, M.J.
2011-04-16 8:24 ` print_npx_status_word Mark Kettenis
2011-04-16 13:46 ` print_npx_status_word Baars, M.J.
2011-04-16 14:29 ` print_npx_status_word Daniel Jacobowitz
2011-04-16 16:21 ` print_npx_status_word Baars, M.J.
2011-04-16 16:33 ` print_npx_status_word Mark Kettenis
2011-04-16 16:47 ` print_npx_status_word Baars, M.J.
2011-04-16 17:10 ` print_npx_status_word Mark Kettenis
2011-04-16 17:55 ` print_npx_status_word Baars, M.J.
2011-04-16 18:07 ` print_npx_status_word Marek Polacek
2011-04-18 17:00 ` print_npx_status_word Tom Tromey
2011-04-16 16:45 ` print_npx_status_word Eli Zaretskii
[not found] ` <4DA99DA1.2090708__5871.13250880993$1302961604$gmane$org@gmail.com>
2011-04-18 17:04 ` print_npx_status_word Tom Tromey
2011-04-19 19:01 ` Baars, M.J. [this message]
2011-04-19 19:53 ` print_npx_status_word Pedro Alves
2011-04-19 20:11 ` print_npx_status_word Tom Tromey
2011-04-18 17:04 ` print_npx_status_word Tom Tromey
2011-04-14 16:17 print_npx_status_word Baars, M.J.
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=4DADDBE2.8050704@gmail.com \
--to=mjbaars1977.gdb@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=gdb@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
--cc=tromey@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