1DBX(5) File Formats Manual DBX(5)
2
3
4
6 dbx - dbx symbol table information
7
9 The compiler symbol information generated for dbx(1) uses the same
10 structure as described in stab(5), with additional type and scope
11 information appended to a symbol's name. The assembler directive used
12 to describe symbol information has the following format:
13
14 stabs ``string'',kind,0,size,value
15
16 String contains the name, source language type, and scope of the sym‐
17 bol, kind specifies the memory class (e.g., external, static, parame‐
18 ter, local, register), and size specifies the byte size of the object,
19 if relevant. The third field (0 above) is unused. For a global vari‐
20 able or a type, value is unused; for a local variable or parameter, it
21 is the offset from the frame pointer, for a register variable, it is
22 the associated register number.
23
24 The different kinds of stab entries are interpreted by dbx as follows:
25
26 N_GSYM The symbol is a global variable (e.g., .comm variable). The
27 variable's address can be found from the corresponding ld(1)
28 symbol entry, thus the value field for N_GSYM symbols is
29 ignored. For example, a global variable ``x'' will have both
30 an N_GSYM entry and an ld(1) entry (e.g., N_BSS + N_EXT).
31 See a.out(5) for details about these other entries. of
32
33 N_FUN The symbol is a procedure or function. The size field con‐
34 tains the line number of the entry point. The value field
35 contains the address of the entry point (in the text seg‐
36 ment).
37
38 N_STSYM The symbol is a statically allocated variable for which an
39 initial value has been specified. The value field contains
40 the address of the variable (in the data segment).
41
42 N_LCSYM The symbol is statically allocated, but not initialized.
43
44 N_RSYM The symbol is a register variable whose value is kept in the
45 register denoted by the value field.
46
47 N_PSYM The symbol is a parameter whose value is pushed on the stack
48 before the call. The value field contains the offset from
49 the argument base pointer (on the VAX, the ap register).
50
51 N_LSYM The symbol is a local variable whose value is stored in the
52 most recently defined procedure's stack frame. The value is
53 the (often negative) offset from the frame pointer (on the
54 VAX, the fp register).
55
56 N_PC, N_MOD2
57 The symbol defines separate compilation information for pre-
58 linking checking for Berkeley Pascal and DEC Modula-2 pro‐
59 grams respectively. For Pascal, the value field contains the
60 line number that the symbol is defined on. The value field
61 is not used for Modula-2.
62
63 Most of the source level information about a symbol is stored in the
64 string field of the stab entry. Since strings are kept in a separate
65 string table in the a.out file, they can be arbitrarily long. Thus
66 there are no restrictions on the kind or length of information in the
67 string field, and it was not necessary to modify the assembler or
68 loader when extending or modifying the format of this information.
69
70
71 Below is a grammar describing the syntax of the symbol string. Except
72 in the case of a constant whose value is a string, there are no blanks
73 in a symbol string.
74
75 NAME: [a-zA-Z_][a-zA-Z_0-9]*
76 INTEGER: [-][0-9][0-9]*
77 REAL: [+-][0-9]*(.[0-9][0-9]*|)([eE]([+-]|)[0-9][0-9]*|)
78 STRING: ``.*''
79 BSTRING: .*
80
81 String:
82 NAME `:' Class
83 `:' Class
84
85 Class:
86 `c' `=' Constant `;'
87 Variable
88 Procedure
89 Parameter
90 NamedType
91 `X' ExportInfo -- export or import information (for N_MOD2 only)
92
93 Constant:
94 `i' INTEGER
95 `r' REAL
96 `c' OrdValue
97 `b' OrdValue
98 `s' STRING
99 `e' TypeId `,' OrdValue
100 `S' TypeId `,' NumElements `,' NumBits `,' BSTRING
101
102 OrdValue:
103 INTEGER
104
105 NumElements:
106 INTEGER
107
108 NumBits:
109 INTEGER
110
111 Variable:
112 TypeId -- local variable of type TypeId
113 `r' TypeId -- register variable of type TypeId
114 `S' TypeId -- module variable of type TypeId (static global in C)
115 `V' TypeId -- own variable of type TypeId (static local in C)
116 `G' TypeId -- global variable of type TypeId
117
118 Procedure:
119 Proc -- top level procedure
120 Proc `,' NAME `,' NAME -- local to first NAME,
121 -- second NAME is corresponding ld symbol
122
123 Proc:
124 `P' -- global procedure
125 `Q' -- local procedure (static in C)
126 `I' -- internal procedure (different calling sequence)
127 `F' TypeId -- function returning type TypeId
128 `f' TypeId -- local function
129 `J' TypeId -- internal function
130
131 Parameter:
132 `p' TypeId -- value parameter of type TypeId
133 `v' TypeId -- reference parameter of type TypeId
134
135 NamedType:
136 `t' TypeId -- type name for type TypeId
137 `T' TypeId -- C structure tag name for struct TypeId
138
139 TypeId:
140 INTEGER -- Unique (per compilation) number of type
141 INTEGER `=' TypeDef -- Definition of type number
142 INTEGER `=' TypeAttrs TypeDef
143
144 --
145 -- Type attributes are extra information associated with a type,
146 -- such as alignment constraints or pointer checking semantics.
147 -- Dbx interprets some of these, but will ignore rather than complain
148 -- about any it does not recognize. Therefore this is a way to add
149 -- extra information for pre-linking checking.
150 --
151 TypeAttrs:
152 `@' TypeAttrList `;'
153
154 TypeAttrList:
155 TypeAttrList `,' TypeAttr
156 TypeAttr
157
158 TypeAttr:
159 `a' INTEGER -- align boundary
160 `s' INTEGER -- size in bits
161 `p' INTEGER -- pointer class (e.g., checking)
162 BSTRING -- something else
163
164 TypeDef:
165 INTEGER
166 Subrange
167 Array
168 Record
169 `e' EnumList `;' -- enumeration
170 `*' TypeId -- pointer to TypeId
171 `S' TypeId -- set of TypeId
172 `d' TypeId -- file of TypeId
173 ProcedureType
174 `i' NAME `:' NAME `;' -- imported type ModuleName:Name
175 `o' NAME `;' -- opaque type
176 `i' NAME `:' NAME `,' TypeId `;'
177 `o' NAME `,' TypeId `;'
178
179 Subrange:
180 `r' TypeId `;' INTEGER `;' INTEGER
181
182 Array:
183 `a' TypeId `;' TypeId -- array [TypeId] of TypeId
184 `A' TypeId -- open array of TypeId
185 `D' INTEGER `,' TypeId -- N-dim. dynamic array
186 `E' INTEGER `,' TypeId -- N-dim. subarray
187
188 ProcedureType:
189 `f' TypeId `;' -- C function type
190 `f' TypeId `,' NumParams `;' TParamList `;'
191 `p' NumParams `;' TParamList `;'
192
193 NumParams:
194 INTEGER
195
196 Record:
197 `s' ByteSize FieldList `;' -- structure/record
198 `u' ByteSize FieldList `;' -- C union
199
200 ByteSize:
201 INTEGER
202
203 FieldList :
204 Field
205 FieldList Field
206
207 Field:
208 NAME `:' TypeId `,' BitOffset `,' BitSize `;'
209
210 BitSize:
211 INTEGER
212
213 BitOffset:
214 INTEGER
215
216 EnumList:
217 Enum
218 EnumList Enum
219
220 Enum:
221 NAME `:' OrdValue `,'
222
223 ParamList:
224 Param
225 ParamList Param
226
227 Param:
228 NAME `:' TypeId `,' PassBy `;'
229
230 PassBy:
231 INTEGER
232
233 TParam:
234 TypeId `,' PassBy `;'
235
236 TParamList :
237 TParam
238 TParamList TParam
239
240 Export:
241 INTEGER ExportInfo
242
243 ExportInfo:
244 `t' TypeId
245 `f' TypeId `,' NumParams `;' ParamList `;'
246 `p' NumParams `;' ParamList `;'
247 `v' TypeId
248 `c' `=' Constant
249
250
251 A `?' indicates that the symbol information is continued in the next
252 stab entry. This directive can only occur where a `;' would otherwise
253 separate the fields of a record or constants in an enumeration. It is
254 useful when the number of elements in one of these lists is large.
255
257 dbx(1), stab(5), a.out(5)
258
259
260
2614.3 Berkeley Distribution January 12, 1986 DBX(5)