More SSE infrastructure

Mark Kettenis kettenis@wins.uva.nl
Wed Jul 5 06:45:00 GMT 2000


   Date: Wed, 5 Jul 2000 00:16:46 -0700
   From: Richard Henderson <rth@cygnus.com>

   On Tue, Jul 04, 2000 at 02:19:58AM +0200, Mark Kettenis wrote:
   > It would make some sense though to make the __m128 type similar to the
   > SSE registers.

   I don't agree.  If you wanted v4sf, you can use v4sf in the source.
   Though not, admittedly, with Intel's interface.  But you can get it
   from GCC easily enough.

Whatever, I don't really care.

   In any case, the question at hand has absolutely nothing to do with
   SSE specifically, but rather what we should give GDB for describing
   a 128-bit integer.

[snip]

   So, the object being, fix the debugging code to cope with integer
   objects larger than twice the host word size.  And in order to do
   that, we need to know what GDB needs to do its job.

I'm assuming you're talking about stabs here.

   In the original message I sent, perhaps only to the GCC list (oops),
   I quoted a fragment from the stabs emitter, wherein we look to see
   if it's easy to print the upper bound for the type.  If it isn't
   easy, we just print -1.

If the lower bound is 0 and the upper bound is -1, GDB interprets the
type as an unsigned integer with the size of the hosts natural integer
type (i.e. 4 bytes on a 32-bit machine).

   So the question is, do we really have to print the correct upper
   and lower bounds for the 128-bit type, or can we just use 0 and -1,
   as the existing code would suggest.

GDB uses the range info to determine the size of an object, even for
global symbols where it might be able to get the size from the symbol
table.  So using 0 and -1 wouldn't produce anything useful.

Giving the correct upper and lower bounds does work (tested on Solaris
2.6, with a recent GDB snapshot and egcs-2.91.66, where I added the
stab for a 128-bit type by hand).  GDB happily prints a 128-bit
hexadecimal constant when I ask it to print the value of a 128-bit
variable, but refuses to evaluate any complex expressions using this
variable, telling me that it cannot do such things on integer
variables larger than 8 bytes.

If printing correct lower and upper bounds is too hard for GCC, there
are alternatives.  If the lower bound is 0 and the upper bound is a
negative number, GDB assumes the size of the type (in bytes) is the
absolute value of the upper bound.  I've verified that emitting:

.stabs "__m128:t(0,20)=r(0,20);0;-16;",128,0,0,0

does indeed work.  The GNU stabs info file suggests that this is a
Convex convention.

It seems that GDB also supports type attributes (an AIX extension, see
the GNU stabs info file).  So

.stabs "__m128:t(0,20)=@s128;r(0,20);0;-1;",128,0,0,0

also works.

The relevant bits of code in GDB are stabsread.c:read_range_type()
(which interprets the lower and upper bound) and
stabsread.c:read_type() (which is sopposed to interpret the entire
stabs type string, and interprets the `s' type attribute).

Mark


More information about the Gdb mailing list