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