Next: , Previous: Program Structure, Up: Top   [Contents][Index]


3 Constants

The ‘c’ symbol descriptor indicates that this stab represents a constant. This symbol descriptor is an exception to the general rule that symbol descriptors are followed by type information. Instead, it is followed by ‘=’ and one of the following:

b value

Boolean constant. value is a numeric value; I assume it is 0 for false or 1 for true.

c value

Character constant. value is the numeric value of the constant.

e type-information , value

Constant whose value can be represented as integral. type-information is the type of the constant, as it would appear after a symbol descriptor (see String Field). value is the numeric value of the constant. GDB 4.9 does not actually get the right value if value does not fit in a host int, but it does not do anything violent, and future debuggers could be extended to accept integers of any size (whether unsigned or not). This constant type is usually documented as being only for enumeration constants, but GDB has never imposed that restriction; I don’t know about other debuggers.

i value

Integer constant. value is the numeric value. The type is some sort of generic integer type (for GDB, a host int); to specify the type explicitly, use ‘e’ instead.

r value

Real constant. value is the real value, which can be ‘INF’ (optionally preceded by a sign) for infinity, ‘QNAN’ for a quiet NaN (not-a-number), or ‘SNAN’ for a signalling NaN. If it is a normal number the format is that accepted by the C library function atof.

s string

String constant. string is a string enclosed in either ‘'’ (in which case ‘'’ characters within the string are represented as ‘\'’ or ‘"’ (in which case ‘"’ characters within the string are represented as ‘\"’).

S type-information , elements , bits , pattern

Set constant. type-information is the type of the constant, as it would appear after a symbol descriptor (see String Field). elements is the number of elements in the set (does this means how many bits of pattern are actually used, which would be redundant with the type, or perhaps the number of bits set in pattern? I don’t get it), bits is the number of bits in the constant (meaning it specifies the length of pattern, I think), and pattern is a hexadecimal representation of the set. AIX documentation refers to a limit of 32 bytes, but I see no reason why this limit should exist. This form could probably be used for arbitrary constants, not just sets; the only catch is that pattern should be understood to be target, not host, byte order and format.

The boolean, character, string, and set constants are not supported by GDB 4.9, but it ignores them. GDB 4.8 and earlier gave an error message and refused to read symbols from the file containing the constants.

The above information is followed by ‘;’.


Next: , Previous: Program Structure, Up: Top   [Contents][Index]