Go to the first, previous, next, last section, table of contents.

Simple types

Basic type definitions

Directive:
.stabs
Type:
N_LSYM
Symbol Descriptor:
t

The basic types for the language are described using the N_LSYM stab type. They are boilerplate and are emited by the compiler for each compilation unit. Basic type definitions are not always a complete description of the type and are sometimes circular. The debugger recognizes the type anyway, and knows how to read bits as that type.

Each language and compiler defines a slightly different set of basic types. In this example we are looking at the basic types for C emited by the GNU compiler targeting the Sun4. Here the basic types are mostly defined as range types.

Range types defined by min and max value

Type Descriptor:
r

When defining a range type, if the number after the first semicolon is smaller than the number after the second one, then the two numbers represent the smallest and the largest values in the range.

4  .text
5  Ltext0:

.stabs "name:
        descriptor  (type)
        type-def=
        type-desc
        type-ref;
        low-bound;
        high-bound;
       ",
       N_LSYM, NIL, NIL, NIL

6  .stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0
7  .stabs "char:t2=r2;0;127;",128,0,0,0

Here the integer type (1) is defined as a range of the integer type (1). Likewise char is a range of char. This part of the definition is circular, but at least the high and low bound values of the range hold more information about the type.

Here short unsigned int is defined as type number 8 and described as a range of type int, with a minimum value of 0 and a maximum of 65535.

13 .stabs "short unsigned int:t8=r1;0;65535;",128,0,0,0

Range type defined by number of bits

Type Descriptor:
r

In a range definition, if the number after the second semicolon is 0, then the number after the first semicolon is the number of bits needed to represent the type.

.stabs "name:
        desc
        type-def=
        type-desc
        type-ref;
        bit-count;
        0;
       ",
       N_LSYM, NIL, NIL, NIL

17 .stabs "float:t12=r1;4;0;",128,0,0,0
18 .stabs "double:t13=r1;8;0;",128,0,0,0
19 .stabs "long double:t14=r1;8;0;",128,0,0,0

Cosmically enough, the void type is defined directly in terms of itself.

.stabs "name:
        symbol-desc
        type-def=
        type-ref
       ",N_LSYM,NIL,NIL,NIL

20 .stabs "void:t15=15",128,0,0,0

Go to the first, previous, next, last section, table of contents.