Defining Builtin Types Using Builtin Type Descriptors
-----------------------------------------------------
This is the method used by Sun's `acc' for defining builtin types.
These are the type descriptors to define builtin types:
`b SIGNED CHAR-FLAG WIDTH ; OFFSET ; NBITS ;'
Define an integral type. SIGNED is `u' for unsigned or `s' for
signed. CHAR-FLAG is `c' which indicates this is a character
type, or is omitted. I assume this is to distinguish an integral
type from a character type of the same size, for example it might
make sense to set it for the C type `wchar_t' so the debugger can
print such variables differently (Solaris does not do this). Sun
sets it on the C types `signed char' and `unsigned char' which
arguably is wrong. WIDTH and OFFSET appear to be for small
objects stored in larger ones, for example a `short' in an `int'
register. WIDTH is normally the number of bytes in the type.
OFFSET seems to always be zero. NBITS is the number of bits in
the type.
Note that type descriptor `b' used for builtin types conflicts with
its use for Pascal space types (Note:Miscellaneous Types); they
can be distinguished because the character following the type
descriptor will be a digit, `(', or `-' for a Pascal space type, or
`u' or `s' for a builtin type.
`w'
Documented by AIX to define a wide character type, but their
compiler actually uses negative type numbers (Note:Negative Type
Numbers).
`R FP-TYPE ; BYTES ;'
Define a floating point type. FP-TYPE has one of the following
values:
`1 (NF_SINGLE)'
IEEE 32-bit (single precision) floating point format.
`2 (NF_DOUBLE)'
IEEE 64-bit (double precision) floating point format.
`3 (NF_COMPLEX)'
`4 (NF_COMPLEX16)'
`5 (NF_COMPLEX32)'
These are for complex numbers. A comment in the GDB source
describes them as Fortran `complex', `double complex', and
`complex*16', respectively, but what does that mean? (i.e.,
Single precision? Double precision?).
`6 (NF_LDOUBLE)'
Long double. This should probably only be used for Sun format
`long double', and new codes should be used for other floating
point formats (`NF_DOUBLE' can be used if a `long double' is
really just an IEEE double, of course).
BYTES is the number of bytes occupied by the type. This allows a
debugger to perform some operations with the type even if it
doesn't understand FP-TYPE.
`g TYPE-INFORMATION ; NBITS'
Documented by AIX to define a floating type, but their compiler
actually uses negative type numbers (Note:Negative Type
Numbers).
`c TYPE-INFORMATION ; NBITS'
Documented by AIX to define a complex type, but their compiler
actually uses negative type numbers (Note:Negative Type
Numbers).
The C `void' type is defined as a signed integral type 0 bits long:
.stabs "void:t19=bs0;0;0",128,0,0,0
The Solaris compiler seems to omit the trailing semicolon in this
case. Getting sloppy in this way is not a swift move because if a type
is embedded in a more complex expression it is necessary to be able to
tell where it ends.
I'm not sure how a boolean type is represented.