Wednesday, February 27, 2002

Overview of Stab Format
There are three overall formats for stab assembler directives, differentiated by the first word of the stab. The name of the directive describes which combination of four possible data fields follows. It is either .stabs (string), .stabn (number), or .stabd (dot). IBM's XCOFF assembler uses .stabx (and some other directives such as .file and .bi) instead of .stabs, .stabn or .stabd.
The overall format of each class of stab is:
.stabs "string",type,other,desc,value
.stabn type,other,desc,value
.stabd type,other,desc
.stabx "string",value,type,sdb-type

For .stabn and .stabd, there is no string (the n_strx field is zero; see section Symbol Information in Symbol Tables). For .stabd, the value field is implicit and has the value of the current file location. For .stabx, the sdb-type field is unused for stabs and can always be set to zero. The other field is almost always unused and can be set to zero.
The number in the type field gives some basic information about which type of stab this is (or whether it is a stab, as opposed to an ordinary symbol). Each valid type number defines a different stab type; further, the stab type defines the exact interpretation of, and possible values for, any remaining string, desc, or value fields present in the stab. See section Table of Stab Types, for a list in numeric order of the valid type field values for stab directives.
The String Field