Fixes for '#ifndef file_h' -- trim off the path prefix and translate all
[unix-history] / usr / src / old / dbx / dbx.5.5
CommitLineData
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 10dbx \- dbx symbol table information
4cf9bc26
KM
11.SH DESCRIPTION
12The compiler symbol information generated
13for \fIdbx\fP(1) uses the same structure
14as described in \fIstab\fP(5), with additional type and scope information
15appended to a symbol's name.
16The assembler directive used to describe symbol information
17has 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.
26The third field (0 above) is unused.
27For a global variable or a type, \fIvalue\fR is unused;
28for a local variable or parameter, it is the offset from the frame pointer,
29for a register variable, it is the associated register number.
30.PP
31The different kinds of stab entries are interpreted by dbx as follows:
32.IP N_GSYM 10
33The symbol is a global variable (e.g., .comm variable).
34The variable's address can be found from the corresponding
35ld(1) symbol entry, thus the value field for N_GSYM symbols is ignored.
36For example, a global variable ``x'' will have both an N_GSYM entry and
37an \fIld\fP(1) entry (e.g., N_BSS + N_EXT).
38See \fIa.out\fP(5) for details about these other entries.
39of
40.IP N_FUN
41The symbol is a procedure or function.
42The size field contains the line number of the entry point.
43The value field contains the address of the entry point (in the text segment).
44.IP N_STSYM
45The symbol is a statically allocated variable for which
46an initial value has been specified.
47The value field contains the address of the variable (in the data segment).
48.IP N_LCSYM
49The symbol is statically allocated, but not initialized.
50.IP N_RSYM
51The symbol is a register variable whose value is kept in the register
52denoted by the value field.
53.IP N_PSYM
54The symbol is a parameter whose value is pushed on the stack before the call.
55The value field contains the offset from the argument base pointer
56(on the VAX, the ap register).
57.IP N_LSYM
58The symbol is a local variable whose value is stored in the most recently
59defined procedure's stack frame.
60The value is the (often negative) offset from the frame pointer
61(on the VAX, the fp register).
62.IP "N_PC, N_MOD2"
63The symbol defines separate compilation information
64for pre-linking checking for Berkeley Pascal and DEC Modula-2 programs
65respectively.
66For Pascal, the value field contains the line number
67that the symbol is defined on.
68The value field is not used for Modula-2.
69.PP
70Most of the source level information about a symbol
71is stored in the string field of the stab entry.
72Since strings are kept in a separate string table in the a.out file,
73they can be arbitrarily long.
74Thus there are no restrictions on the kind or length of information
75in the string field, and it was not necessary
76to modify the assembler or loader when extending or modifying
77the format of this information.
004ce311 78.sp
4cf9bc26
KM
79.PP
80Below is a grammar describing the syntax of the symbol string.
81Except in the case of a constant whose value is a string,
82there are no blanks in a symbol string.
83.nf
84.ta 1i 2i 3i 4i 5i 6i 7i
85.sp 1
86NAME: [a-zA-Z_][a-zA-Z_0-9]*
87INTEGER: [-][0-9][0-9]*
88REAL: [+-][0-9]*(\.[0-9][0-9]*|)([eE]([+-]|)[0-9][0-9]*|)
89STRING: ``.*''
90BSTRING: .*
91
92String:
93 NAME `:' Class
94 `:' Class
95
96Class:
97 `c' `=' Constant `;'
98 Variable
99 Procedure
100 Parameter
101 NamedType
102 `X' ExportInfo -- export or import information (for N_MOD2 only)
103
104Constant:
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
113OrdValue:
114 INTEGER
115
116NumElements:
117 INTEGER
118
119NumBits:
120 INTEGER
121
122Variable:
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
129Procedure:
130 Proc -- top level procedure
131 Proc `,' NAME `,' NAME -- local to first NAME,
132 -- second NAME is corresponding ld symbol
133
134.need 8
135Proc:
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
143Parameter:
144 `p' TypeId -- value parameter of type TypeId
145 `v' TypeId -- reference parameter of type TypeId
146
147NamedType:
148 `t' TypeId -- type name for type TypeId
149 `T' TypeId -- C structure tag name for struct TypeId
150
151TypeId:
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--
163TypeAttrs:
164 `@' TypeAttrList `;'
165
166TypeAttrList:
167 TypeAttrList `,' TypeAttr
168 TypeAttr
169
170TypeAttr:
171 `a' INTEGER -- align boundary
172 `s' INTEGER -- size in bits
173 `p' INTEGER -- pointer class (e.g., checking)
174 BSTRING -- something else
175
176TypeDef:
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
191Subrange:
192 `r' TypeId `;' INTEGER `;' INTEGER
193
194Array:
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
200ProcedureType:
201 `f' TypeId `;' -- C function type
202 `f' TypeId `,' NumParams `;' TParamList `;'
203 `p' NumParams `;' TParamList `;'
204
205NumParams:
206 INTEGER
207
208Record:
209 `s' ByteSize FieldList `;' -- structure/record
210 `u' ByteSize FieldList `;' -- C union
211
212ByteSize:
213 INTEGER
214
215FieldList :
216 Field
217 FieldList Field
218
219Field:
220 NAME `:' TypeId `,' BitOffset `,' BitSize `;'
221
222BitSize:
223 INTEGER
224
225BitOffset:
226 INTEGER
227
228EnumList:
229 Enum
230 EnumList Enum
231
232Enum:
233 NAME `:' OrdValue `,'
234
235ParamList:
236 Param
237 ParamList Param
238
239Param:
240 NAME `:' TypeId `,' PassBy `;'
241
242PassBy:
243 INTEGER
244
245TParam:
246 TypeId `,' PassBy `;'
247
248TParamList :
249 TParam
250 TParamList TParam
251
252Export:
253 INTEGER ExportInfo
254
255ExportInfo:
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
264A `?' indicates that the symbol information is continued in
265the next stab entry.
266This directive can only occur where a `;' would otherwise
267separate the fields of a record or constants in an enumeration.
268It is useful when the number of elements in one of these lists
269is large.
4cf9bc26
KM
270.SH "SEE ALSO"
271dbx(1), stab(5), a.out(5)