🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #10009

gdb decstation floating point bug/fix

#10009
From: Douglas Michael DeCarlo
Date: Sun, 07 Oct 1990 22:11
26 lines
1617 bytes
In gdb 3.5, for decstations, the macro for INVALID_FLOAT defined in
m-mips.h is not correct.  The macro is as follows:

#define INVALID_FLOAT(p, len) ((*(short *) p & 0xff80) == 0x8000)

For floats on a mips, the floats are 1 sign bit, 8 exponent bits, 23
mantissa bit (with the sign bit most significant).  But, the above
macro, since decstations are byte-wise braindead (or vax-like), the
above bit operation is happening somewhere in the mantissa.  The
following is what happens:
	(gdb) print (float)331
	Invalid float value

To fix this, I think (though I wouldn't bet any amount) that the
following macro is a correct fix:

#define INVALID_FLOAT(p,len) ((*(int *)p & 0xff800000) == 0x80000000)

Worst case, you could just make the macro into the degenerate version
(which many systypes seem to have):
#define INVALID_FLOAT(p,len) 0

Oh yeah, you probably don't want to just change the m-mips.h file, but
make a separate file for decstations and Mips machines.

- Doug DeCarlo
Technical Details
Message-ID: <Qb3uTsC00Vp5A0wEJ=@andrew.cmu.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!dd2i+

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,e088e61fe553f10b,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1990-10-07 15:58:34 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!dd2i+
From: dd2i+@andrew.cmu.edu (Douglas Michael DeCarlo)
Newsgroups: gnu.gdb.bug
Subject: gdb decstation floating point bug/fix
Message-ID: <Qb3uTsC00Vp5A0wEJ=@andrew.cmu.edu>
Date: 7 Oct 90 22:11:04 GMT
Organization: Electrical and Comp. Engineering, Carnegie Mellon, Pittsburgh, PA
Lines: 26
Posted: Sun Oct  7 23:11:04 1990