DBX(5) —
NAME
dbx − dbx symbol table information
DESCRIPTION
The compiler symbol information generated for dbx(1) uses the same structure as described in stab(5), with additional type and scope information appended to a symbol’s name. The assembler directive used to describe symbol information has the following format:
.stabs “string”,kind,0,size,value
String contains the name, source language type, and scope of the symbol, kind specifies the memory class (e.g., external, static, parameter, local, register), and size specifies the byte size of the object, if relevant. The third field (0 above) is unused. For a global variable or a type, value is unused; for a local variable or parameter, it is the offset (defined below); for a register variable, it is the associated register number.
The different kinds of stab entries are interpreted by dbx as follows:
N_GSYMThe symbol is a global variable (e.g., .comm variable). The variable’s address can be found from the corresponding ld(1) symbol entry, thus value for N_GSYM symbols is ignored. For example, a global variable “x” will have both an N_GSYM entry and an ld(1) entry (e.g., N_BSS + N_EXT). See a.out(5) for details about these other entries.
N_FUNThe symbol is a procedure or function. Size contains the line number of the entry point. Value contains the address of the entry point (in the text segment).
N_STSYM
The symbol is a statically allocated variable for which an initial value has been specified. Value contains the address of the variable (in the data segment).
N_LCSYM
The symbol is statically allocated, but not initialized.
N_RSYMThe symbol is a register variable whose value is kept in the register denoted by value.
N_PSYMThe symbol is a parameter whose value may be pushed on the stack before the call, or may be passed in r2-r5. Value contains the offset from the base of the argument list (16 bytes below the top of the stack frame).
N_LSYMThe symbol is a local variable whose value is located in the most recently defined procedure’s stack frame. Value is the offset (always negative) from the top of the local data area.
N_PC, N_MOD2
(Unsupported.) The symbol defines separate compilation information for pre-linking checking for Berkeley Pascal and Modula-2 programs respectively. For Pascal, the value field contains the line number that the symbol is defined on. The value field is not used for Modula-2.
N_SOThe symbol is a source file name. Size is 0 if compiled by pcc, 1 if by hc or pp.
The compilers order LBRAC, RBRAC, and symbol stabs by the following rules:
•Except for the following, every name scope is represented by an LBRAC/RBRAC pair:
−File scope has no LBRAC/RBRAC pair.
−Pcc omits the pair corresponding to a function definition (a function declaration followed by a function body).
−Pcc omits the pair corresponding to the braces surrounding a function body, unless at least one declaration immediately follows the left brace.
•Pcc places symbol stabs before the scope-opening LBRAC stab. Hc and pp place symbol stabs after the scope-opening LBRAC stab, matching the order of declarations and { }’s in the source.
Most of the source level information about a symbol is stored in the string field of the stab entry. Since strings are kept in a separate string table in the a.out file, they can be arbitrarily long. Thus there are no restrictions on the kind or length of information in the string field, and it was not necessary to modify the assembler or loader when extending or modifying the format of this information.
Below is a grammar describing the syntax of the symbol string. Except in the case of a constant whose value is a string, there are no blanks in a symbol string.
NAME:[a-zA-Z_][a-zA-Z_0-9]∗
INTEGER:[-][0-9][0-9]∗
REAL:[+-][0-9]∗(.[0-9][0-9]∗|)([eE]([+-]|)[0-9][0-9]∗|)
STRING:“.∗”-- \" represents "
String:
NAME ‘:’ Class
‘:’ Class
Class:
‘c’ ‘=’ Constant ‘;’
Variable-- d, r, G, S, V, TypeId
Procedure-- f, F, J, P, Q
Parameter-- a, p, v, D, R
NamedType-- t, T
Constant:
‘i’ INTEGER
‘r’ REAL
‘c’ OrdValue
‘b’ OrdValue
‘s’ STRING
‘e’ TypeId ‘,’ OrdValue
‘S’ TypeId ‘,’ NumElements ‘,’ NumBits ‘,’ [01]∗
OrdValue:
INTEGER
NumElements:
INTEGER
NumBits:
INTEGER
Variable:
TypeId-- local variable of type TypeId
‘d’ TypeId-- floating register variable of type TypeId
‘r’ TypeId-- register variable of type TypeId
‘S’ TypeId-- module variable of type TypeId (static global in C)
‘V’ TypeId-- own variable of type TypeId (static local in C)
‘G’ TypeId-- global variable of type TypeId
Procedure:
Proc-- top level procedure
Proc ‘,’ NAME ‘,’ NAME-- local to first NAME,
-- second NAME is corresponding ld symbol
Proc:
‘P’-- global procedure
‘Q’-- local procedure
‘F’ TypeId-- function returning type TypeId
‘f’ TypeId-- local function (static in C)
‘J’ TypeId-- internal function
Parameter:
‘a’ TypeId-- parameter passed by reference, in general register (Pascal only)
‘p’ TypeId-- value parameter
‘v’ TypeId-- parameter passed by reference (Pascal only)
‘D’ TypeId-- value parameter in floating point register
‘R’ TypeId-- value parameter in general register
NamedType:
‘t’ TypeId-- type name for type TypeId
‘T’ TypeId-- C structure tag name for struct TypeId
TypeId:
INTEGER-- Unique (per compilation) number of type
INTEGER ‘=’ TypeDef-- Definition of type number
INTEGER ‘=’ TypeAttrs TypeDef
--
-- Type attributes are extra information associated with a type,
-- such as alignment constraints or pointer checking semantics.
-- Dbx interprets some of these, but will ignore rather than complain
-- about any it does not recognize. Therefore this is a way to add
-- extra information for pre-linking checking.
--
TypeAttrs:
‘@’ TypeAttrList ‘;’
TypeAttrList:
TypeAttrList ‘,’ TypeAttr
TypeAttr
TypeAttr:
‘a’ INTEGER-- align boundary
‘s’ INTEGER-- size in bits
‘p’ INTEGER-- pointer class (e.g., checking)
BSTRING-- something else
TypeDef:
INTEGER
Subrange
Array
Record
‘e’ EnumList ‘;’-- enumeration
‘∗’ TypeId-- pointer to TypeId
‘S’ TypeId-- set of TypeId
‘d’ TypeId-- file of TypeId
ProcedureType
‘i’ NAME ‘:’ NAME ‘;’-- imported type ModuleName:Name
‘o’ NAME ‘;’-- opaque type
‘i’ NAME ‘:’ NAME ‘,’ TypeId ‘;’
‘o’ NAME ‘,’ TypeId ‘;’
Subrange:
‘r’ TypeId ‘;’ INTEGER ‘;’ INTEGER
Array:
‘a’ TypeDef ‘;’ TypeId-- array [TypeD] of TypeId
‘A’ TypeId-- open array of TypeId
‘D’ INTEGER ‘,’ TypeId-- N-dim. dynamic array
‘E’ INTEGER ‘,’ TypeId-- N-dim. subarray
ProcedureType:
‘f’ TypeId ‘;’-- C function type
‘f’ TypeId ‘,’ NumParams ‘;’ TParamList ‘;’
‘p’ NumParams ‘;’ TParamList ‘;’
NumParams:
INTEGER
Record:
‘s’ ByteSize FieldList ‘;’-- structure/record
‘u’ ByteSize FieldList ‘;’-- C union
ByteSize:
INTEGER
FieldList :
Field
FieldList Field
Field:
NAME ‘:’ TypeId ‘,’ BitOffset ‘,’ BitSize ‘;’
BitSize:
INTEGER
BitOffset:
INTEGER
EnumList:
Enum
EnumList Enum
Enum:
NAME ‘:’ OrdValue ‘,’
ParamList:
Param
ParamList Param
Param:
NAME ‘:’ TypeId ‘,’ PassBy ‘;’
PassBy:
INTEGER
TParam:
TypeId ‘,’ PassBy ‘;’
TParamList :
TParam
TParamList TParam
Export:
INTEGER ExportInfo
ExportInfo:
‘t’ TypeId
‘f’ TypeId ‘,’ NumParams ‘;’ ParamList ‘;’
‘p’ NumParams ‘;’ ParamList ‘;’
‘v’ TypeId
‘c’ ‘=’ Constant
A ‘?’ indicates that the symbol information is continued in the next stab entry. This directive can only occur where a ‘;’ would otherwise separate the fields of a record or constants in an enumeration. It is useful when the number of elements in one of these lists is large.
FILES
stab.h
SEE ALSO
PRPQs 5799-WZQ/5799-PFF: IBM/4.3 — July 1987