Stabs reading on Alpha (Linux)

Jim Blandy jimb@cygnus.com
Thu Jun 24 19:27:00 GMT 1999


> The following patch whacks about 20 testsuite files on Alpha; if you like
> it, I'll check in.  Although the 0xffffffff might confuse a 32-bit machine,
> I believe that the code could never get here on a 32-bit host (it goes
> through the n2bits,n3bits path instead).

We can't continue this approach when we get our first machine with
64-bit longs and 128-bit long longs, because we can't write out the
64-bit constant --- 32-bit compilers will (or should) choke on it.  :)

Could you give this a try?  Or does it seem too baroque?

Index: stabsread.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/stabsread.c,v
retrieving revision 2.158
diff -c -c -b -F'^(' -r2.158 stabsread.c
*** stabsread.c	1999/05/25 02:06:11	2.158
--- stabsread.c	1999/06/24 23:30:55
***************
*** 4669,4686 ****
    /* We used to do this only for subrange of self or subrange of int.  */
    else if (n2 == 0)
      {
        if (n3 < 0)
  	/* n3 actually gives the size.  */
  	return init_type (TYPE_CODE_INT, - n3, TYPE_FLAG_UNSIGNED,
  			  NULL, objfile);
-       if (n3 == 0xff)
- 	return init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, NULL, objfile);
-       if (n3 == 0xffff)
- 	return init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, NULL, objfile);
  
!       /* -1 is used for the upper bound of (4 byte) "unsigned int" and
! 	 "unsigned long", and we already checked for that,
! 	 so don't need to test for it here.  */
      }
    /* I think this is for Convex "long long".  Since I don't know whether
       Convex sets self_subrange, I also accept that particular size regardless
--- 4669,4698 ----
    /* We used to do this only for subrange of self or subrange of int.  */
    else if (n2 == 0)
      {
+       /* -1 is used for the upper bound of (4 byte) "unsigned int" and
+ 	 "unsigned long", and we already checked for that,
+ 	 so don't need to test for it here.  */
+ 
        if (n3 < 0)
  	/* n3 actually gives the size.  */
  	return init_type (TYPE_CODE_INT, - n3, TYPE_FLAG_UNSIGNED,
  			  NULL, objfile);
  
!       /* Is n3 == 2**(8n))-1 for some integer n?  Then it's an
!          unsigned n-byte integer.  But do require n to be a power of
!          two; we don't want 3- and 5-byte integers flying around.  */
!       {
! 	int bytes;
! 	unsigned long bits;
! 
! 	bits = n3;
! 	for (bytes = 0; (bits & 0xff) == 0xff; bytes++)
! 	  bits >>= 8;
! 	if (bits == 0
! 	    && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
! 	  return init_type (TYPE_CODE_INT, bytes, TYPE_FLAG_UNSIGNED, NULL,
! 			    objfile);
!       }
      }
    /* I think this is for Convex "long long".  Since I don't know whether
       Convex sets self_subrange, I also accept that particular size regardless


More information about the Gdb-patches mailing list