Next: C Example Prev: Stabs Format Up: Overview
The String Field
For most stabs the string field holds the meat of the debugging
information. The flexible nature of this field is what makes stabs
extensible. For some stab types the string field contains only a name.
For other stab types the contents can be a great deal more complex.
The overall format of the string field for most stab types is:
NAME is the name of the symbol represented by the stab; it can
contain a pair of colons (Note: Nested Symbols.). NAME can be
omitted, which means the stab represents an unnamed object. For
example, `:t10=*2' defines type 10 as a pointer to type 2, but does not
give the type a name. Omitting the NAME field is supported by AIX dbx
and GDB after about version 4.8, but not other debuggers. GCC
sometimes uses a single space as the name instead of omitting the name
altogether; apparently that is supported by most debuggers.
The SYMBOL-DESCRIPTOR following the `:' is an alphabetic character
that tells more specifically what kind of symbol the stab represents.
If the SYMBOL-DESCRIPTOR is omitted, but type information follows, then
the stab represents a local variable. For a list of symbol
descriptors, see Note: Symbol Descriptors. The `c' symbol descriptor
is an exception in that it is not followed by type information. *Note
TYPE-INFORMATION is either a TYPE-NUMBER, or `TYPE-NUMBER='. A
TYPE-NUMBER alone is a type reference, referring directly to a type
that has already been defined.
The `TYPE-NUMBER=' form is a type definition, where the number
represents a new type which is about to be defined. The type
definition may refer to other types by number, and those type numbers
may be followed by `=' and nested definitions. Also, the Lucid
compiler will repeat `TYPE-NUMBER=' more than once if it wants to
define several type numbers at once.
In a type definition, if the character that follows the equals sign
is non-numeric then it is a TYPE-DESCRIPTOR, and tells what kind of
type is about to be defined. Any other values following the
TYPE-DESCRIPTOR vary, depending on the TYPE-DESCRIPTOR. Note: Type
Descriptors, for a list of TYPE-DESCRIPTOR values. If a number
follows the `=' then the number is a TYPE-REFERENCE. For a full
description of types, Note: Types.
There is an AIX extension for type attributes. Following the `='
are any number of type attributes. Each one starts with `@' and ends
with `;'. Debuggers, including AIX's dbx and GDB 4.10, skip any type
attributes they do not recognize. GDB 4.9 and other versions of dbx
may not do this. Because of a conflict with C++ (Note: Cplusplus.),
new attributes should not be defined which begin with a digit, `(', or
`-'; GDB may be unable to distinguish those from the C++ type
descriptor `@'. The attributes are:
BOUNDARY is an integer specifying the alignment. I assume it
applies to all variables of this type.
Pointer class (for checking). Not sure what this means, or how
INTEGER is interpreted.
Indicate this is a packed type, meaning that structure fields or
array elements are placed more closely in memory, to save memory
at the expense of speed.
Size in bits of a variable of this type. This is fully supported
by GDB 4.11 and later.
Indicate that this type is a string instead of an array of
characters, or a bitstring instead of a set. It doesn't change
the layout of the data being represented, but does enable the
debugger to know which type it is.
All of this can make the string field quite long. All versions of
GDB, and some versions of dbx, can handle arbitrarily long strings.
But many versions of dbx (or assemblers or linkers, I'm not sure which)
cretinously limit the strings to about 80 characters, so compilers which
must work with such systems need to split the `.stabs' directive into
several `.stabs' directives. Each stab duplicates every field except
the string field. The string field of every stab except the last is
marked as continued with a backslash at the end (in the assembly code
this may be written as a double backslash, depending on the assembler).
Removing the backslashes and concatenating the string fields of each
stab produces the original, long string.
automatically generated by info2www