Next: , Previous: Miscellaneous Types, Up: Types


5.3 Cross-References to Other Types

A type can be used before it is defined; one common way to deal with that situation is just to use a type reference to a type which has not yet been defined.

Another way is with the ‘x’ type descriptor, which is followed by ‘s’ for a structure tag, ‘u’ for a union tag, or ‘e’ for a enumerator tag, followed by the name of the tag, followed by ‘:’. If the name contains ‘::’ between a ‘<’ and ‘>’ pair (for C++ templates), such a ‘::’ does not end the name—only a single ‘:’ ends the name; see Nested Symbols.

For example, the following C declarations:

     struct foo;
     struct foo *bar;

produce:

     .stabs "bar:G16=*17=xsfoo:",32,0,0,0

Not all debuggers support the ‘x’ type descriptor, so on some machines GCC does not use it. I believe that for the above example it would just emit a reference to type 17 and never define it, but I haven't verified that.

Modula-2 imported types, at least on AIX, use the ‘i’ type descriptor, which is followed by the name of the module from which the type is imported, followed by ‘:’, followed by the name of the type. There is then optionally a comma followed by type information for the type. This differs from merely naming the type (see Typedefs) in that it identifies the module; I don't understand whether the name of the type given here is always just the same as the name we are giving it, or whether this type descriptor is used with a nameless stab (see String Field), or what. The symbol ends with ‘;’.