This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: x86 FPU support: "info float" and `long double'


> (gdb) info float
> status 0x3800: flags 0000; top 7;
> control 0x37f: 64 bit; NEAR; mask INVAL DENOR DIVZ OVERF UNDER LOS;
> last FP instruction: opcode 0xdd05; pc 0x23:0x8048495; operand 0x2b:0x8048f04
> regno tag     msb              lsb  value
> => 7: valid   4000c90fdaa22168c000  3.141592653589793116
>    6: empty   3ff7d100000000000000  0.006378173828125
>    5: empty   40098000000000000000  1024
>    4: empty   3fff8000000000000000  1
>    3: empty   3fff8000000000000000  1
>    2: empty   3ffb9d8909ff2e48e8c0  0.076921537494659423997
>    1: empty   3ffbdaf3e93361992eb3  0.10691053569844352396
>    0: empty   00000000000000000000  0
> (gdb)  
> 
> Suggestions for improvement are welcome!
> 

My current gdb has

(gdb) info float
     st0: 0x3ffed6d6d6d6d6d6d800  Empty Normal 0.8392156862745098200307
     st1: 0x00000000000000000000  Empty Zero   0
     st2: 0x00000000000000000000  Empty Zero   0
     st3: 0x00000000000000000000  Empty Zero   0
     st4: 0x00000000000000000000  Empty Zero   0
     st5: 0x3ffe8000000000000000  Empty Normal 0.5
     st6: 0x4003b000000000000000  Empty Normal 22
     st7: 0x4003b000000000000000  Empty Normal 22
   fctrl:     0x037f 64 bit; NEAR; mask INVAL DENOR DIVZ OVERF UNDER LOS;
   fstat:     0x0000 flags 0000; top 0; 
    ftag:     0xffff
     fip: 0x00000000
     fcs: 0x00000000
  fopoff: 0x00000000
  fopsel:     0x0000

It is also the same as yours. However, I have an extra field for stack
register:

     st0: 0x3ffed6d6d6d6d6d6d800  Empty Normal 0.8392156862745098200307
					^^^^^^

It shouldn't be hard to add. I am enclosing the relevant code here.


H.J.
----
      expon = extract_unsigned_integer (raw_regs + REGISTER_BYTE (regnum)
					+ 8, 2);
      sign = expon & 0x8000;
      expon &= 0x7fff;
      ms = extract_unsigned_integer (raw_regs + REGISTER_BYTE (regnum) + 4, 4);
      ls = extract_signed_integer (raw_regs + REGISTER_BYTE (regnum), 4);
      norm = ms & 0x80000000;

      if ( expon == 0 )
	{
	  if ( ms | ls )
	    {
	      /* Denormal or Pseudodenormal. */
	      if ( norm )
		puts_unfiltered ("Pseudo ");
	      else
		puts_unfiltered ("Denorm ");
	    }
	  else
	    {
	      /* Zero. */
	      puts_unfiltered ("Zero   ");
	    }
	}
      else if ( expon == 0x7fff )
	{
	  /* Infinity, NaN or unsupported. */
	  if ( (ms == 0x80000000) &&
	       (ls == 0) )
	    {
              puts_unfiltered ("Infty  ");
	    }
	  else if ( norm )
	    {
	      if ( ms & 0x40000000 )
		puts_unfiltered ("QNaN   ");
	      else
		puts_unfiltered ("SNaN   ");
	    }
	  else
	    {
              puts_unfiltered ("Unsupp ");
	    }
	}
      else
	{
	  /* Normal or unsupported. */
	  if ( norm )
	    puts_unfiltered ("Normal ");
	  else
	    puts_unfiltered ("Unsupp ");
	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]