Commit | Line | Data |
---|---|---|
04cbba67 BJ |
1 | .TH SDB 1 VAX/11 |
2 | .SH NAME | |
3 | sdb \- symbolic debugger | |
4 | .SH SYNOPSIS | |
5 | .B sdb | |
6 | [ objfil [ corfil [ directory ] ] ] | |
7 | .SH DESCRIPTION | |
8 | .I Sdb | |
9 | is a symbolic debugger which can be used with C and F77 programs. | |
10 | It may be used to examine their files and to provide | |
11 | a controlled environment for their execution. | |
12 | .PP | |
13 | .I Objfil | |
14 | is an executable program file | |
15 | which has been compiled with the -g (debug) option. | |
16 | The default for | |
17 | .I objfil | |
18 | is | |
19 | .B a.out. | |
20 | .I Corfil | |
21 | is assumed to be a core image file produced after | |
22 | executing | |
23 | .IR objfil ; | |
24 | the default for | |
25 | .I corfil | |
26 | is | |
27 | .B core. | |
28 | The core file need not be present. | |
29 | .PP | |
30 | It is useful to know that at any time there is a | |
31 | .I "current line" | |
32 | and | |
33 | .I "current file." | |
34 | If | |
35 | .I corfil | |
36 | exists then they are initially set to the line and file | |
37 | containing the source statement at which the process terminated or stopped. | |
38 | Otherwise, they are set to the first line in main. | |
39 | The current line and file may be changed with the source file | |
40 | examination commands. | |
41 | .PP | |
42 | Names of variables are written just as they are in C or F77. | |
43 | Variables local to a procedure may be accessed using the form | |
44 | `procedure:variable'. | |
45 | If no procedure name is given, the procedure containing the | |
46 | current line is used by default. | |
47 | It is also possible to refer to structure members as `variable.member', | |
48 | pointers to structure members as `variable\(mi>member' and array elements | |
49 | as `variable[number]'. | |
50 | Combinations of these forms may also be used. | |
51 | .PP | |
52 | It is also possible to specify a variable by its address. | |
53 | All forms of integer constants which are valid in C may be used, so that | |
54 | addresses may be input in decimal, octal or hexadecimal. | |
55 | .PP | |
56 | Line numbers in the source program are referred to as `filename:number' | |
57 | or `procedure:number'. | |
58 | In either case the number is relative to the beginning of the file. | |
59 | If no procedure or file name is given, | |
60 | the current file is used by default. | |
61 | If no number is given, | |
62 | the first line of the named procedure or file is used. | |
63 | .sp 1 | |
64 | .PP | |
65 | The commands for examining data in the program are: | |
66 | .TP 5 | |
67 | .B t | |
68 | Print a stack trace of the terminated or stopped program. | |
69 | .TP 5 | |
70 | .B T | |
71 | Print the top line of the stack trace. | |
72 | .TP 5 | |
73 | variable/\fIlm\fP | |
74 | Print the value of variable according to | |
75 | length | |
76 | .I l | |
77 | and format | |
78 | .I m. | |
79 | If | |
80 | .I l | |
81 | and | |
82 | .I m | |
83 | are omitted, | |
84 | sdb chooses a length and format suitable for the variable's type | |
85 | as declared in the program. | |
86 | The length specifiers are: | |
87 | .RS | |
88 | .TP | |
89 | .BI b | |
90 | one byte | |
91 | .br | |
92 | .ns | |
93 | .TP | |
94 | .BI h | |
95 | two bytes (half word) | |
96 | .br | |
97 | .ns | |
98 | .TP | |
99 | .BI l | |
100 | four bytes (long word) | |
101 | .br | |
102 | .ns | |
103 | .TP | |
104 | number | |
105 | string length for formats | |
106 | .B s | |
107 | and | |
108 | .B a | |
109 | .RE | |
110 | .TP 5 | |
111 | \ | |
112 | Legal values for | |
113 | .I m | |
114 | are: | |
115 | .RS | |
116 | .TP | |
117 | .BI c | |
118 | character | |
119 | .br | |
120 | .ns | |
121 | .TP | |
122 | .BI d | |
123 | decimal | |
124 | .br | |
125 | .ns | |
126 | .TP | |
127 | .BI u | |
128 | decimal, unsigned | |
129 | .br | |
130 | .ns | |
131 | .TP | |
132 | .BI o | |
133 | octal | |
134 | .br | |
135 | .ns | |
136 | .TP | |
137 | .BI x | |
138 | hexadecimal | |
139 | .br | |
140 | .ns | |
141 | .TP | |
142 | .BI f | |
143 | 32 bit single precision floating point | |
144 | .br | |
145 | .ns | |
146 | .TP | |
147 | .BI g | |
148 | 64 bit double precision floating point | |
149 | .br | |
150 | .ns | |
151 | .TP | |
152 | .BI s | |
153 | Assume variable is a string pointer and print characters until a null is | |
154 | reached. | |
155 | .br | |
156 | .ns | |
157 | .TP | |
158 | .BI a | |
159 | Print characters starting at the variable's address until a null | |
160 | is reached. | |
161 | .br | |
162 | .ns | |
163 | .TP | |
164 | .BI p | |
165 | pointer to procedure | |
166 | .RE | |
167 | .TP 5 | |
168 | \ | |
169 | The length specifiers are only effective with the formats | |
170 | \fBd\fP, \fBu\fP, \fBo\fP and \fBx\fP. | |
171 | If | |
172 | one of these formats | |
173 | is specified and | |
174 | .I l | |
175 | is omitted, | |
176 | the length | |
177 | defaults to the word length of the host machine; | |
178 | 4 for the DEC VAX/11-780. | |
179 | The last variable may be redisplayed with the command `./'. | |
180 | .sp | |
181 | The sh(1) metacharacters | |
182 | .B * | |
183 | and | |
184 | .B ? | |
185 | may be used within procedure and variable names, | |
186 | providing a limited form of pattern matching. | |
187 | If no procedure name is given, both variables local to the current | |
188 | procedure and global (common for F77) variables are matched, | |
189 | while if a procedure name is specified then | |
190 | only variables local to that procedure and matched. | |
191 | To match only global variables (or blank common for F77), | |
192 | the form `:pattern' is used. | |
193 | The name of a common block may be specified instead of a procedure name | |
194 | for F77 programs. | |
195 | .RE | |
196 | .TP 5 | |
197 | variable\fB=\fP\fIlm\fP | |
198 | .br | |
199 | .ns | |
200 | .TP 5 | |
201 | linenumber\fB=\fP\fIlm\fP | |
202 | .br | |
203 | .ns | |
204 | .TP 5 | |
205 | number\fB=\fP\fIlm\fP | |
206 | Print the address of the variable or line number or the value of the number | |
207 | in the specified format. | |
208 | If no format is given, then `lx' is used. | |
209 | The last variant of this command provides a convenient way to convert | |
210 | between decimal, octal and hexadecimal. | |
211 | .TP 5 | |
212 | variable\fB!\fPvalue | |
213 | Set the variable to the given value. | |
214 | The value may be a number, character constant or a variable. | |
215 | If the variable is of type float or double, | |
216 | the value may also be a floating constant. | |
217 | .sp 1 | |
218 | .PP | |
219 | The commands for examining source files are | |
220 | .TP 5 | |
221 | \fBe\fP procedure | |
222 | .br | |
223 | .ns | |
224 | .TP 5 | |
225 | \fBe\fP filename.c | |
226 | Set the current file to | |
227 | the file containing the named procedure | |
228 | or the named filename. | |
229 | Set the current line to the first line in the named | |
230 | procedure or file. | |
231 | All source files are assumed to be in | |
232 | .I directory. | |
233 | The default for | |
234 | .I directory | |
235 | is the working directory. | |
236 | If no procedure or file name is given, the current procedure and file names | |
237 | are reported. | |
238 | .TP 5 | |
239 | \fB/\fPregular expression\fB/\fP | |
240 | Search forward from the current line for a line containing | |
241 | a string matching the regular expression as in ed(1). | |
242 | The trailing `/' may be elided. | |
243 | .TP 5 | |
244 | \fB?\fPregular expression\fB?\fP | |
245 | Search backward from the current line for a line containing | |
246 | a string matching the regular expression as in ed(1). | |
247 | The trailing `?' may be elided. | |
248 | .TP 5 | |
249 | .B p | |
250 | Print the current line. | |
251 | .TP 5 | |
252 | .B z | |
253 | Print the current line followed by the next 9 lines. | |
254 | Set the current line to the last line printed. | |
255 | .TP 5 | |
256 | .B control-D | |
257 | Scroll. | |
258 | Print the next 10 lines. | |
259 | Set the current line to the last line printed. | |
260 | .TP 5 | |
261 | .B w | |
262 | Window. | |
263 | Print the 10 lines around the current line. | |
264 | .TP 5 | |
265 | number | |
266 | Set the current line to the given line number. | |
267 | Print the new current line. | |
268 | .TP 5 | |
269 | \fIcount\fB +\fR | |
270 | Advance the current line by \fIcount\fP lines. | |
271 | Print the new current line. | |
272 | .TP 5 | |
273 | \fIcount\fB \(mi\fR | |
274 | Retreat the current line by \fIcount\fP lines. | |
275 | Print the new current line. | |
276 | .sp 1 | |
277 | .PP | |
278 | The commands for controlling the execution of the source program are: | |
279 | .TP 5 | |
280 | \fIcount\fB r \fIargs\fR | |
281 | .br | |
282 | .ns | |
283 | .TP 5 | |
284 | \fIcount\fB R | |
285 | Run the program with the given arguments. | |
286 | The \fBr\fP command with no arguments reuses the previous arguments | |
287 | to the program while the \fBR\fP command | |
288 | runs the program with no arguments. | |
289 | An argument beginning with `<' or `>' causes redirection for the | |
290 | standard input or output respectively. | |
291 | If \fIcount\fP is given, | |
292 | it specifies the number of breakpoints to be ignored. | |
293 | .TP 5 | |
294 | \fIlinenumber\fB c\fI count\fR | |
295 | .br | |
296 | .ns | |
297 | .TP 5 | |
298 | \fIlinenumber\fB C\fI count\fR | |
299 | Continue after a breakpoint or interrupt. | |
300 | If \fIcount\fP is given, | |
301 | it specifies the number of breakpoints to be ignored. | |
302 | \fBC\fP continues with the signal which caused the program to stop and | |
303 | \fBc\fP ignores it. | |
304 | .sp 0.5 | |
305 | If a linenumber is specified | |
306 | then a temporary breakpoint is placed at the line | |
307 | and execution is continued. | |
308 | The breakpoint is deleted when the command finishes. | |
309 | .TP 5 | |
310 | \fIcount\fB s\fR | |
311 | Single step. | |
312 | Run the program through \fIcount\fP lines. | |
313 | If no count is given then the program is run for one line. | |
314 | .TP 5 | |
315 | \fIcount\fB S\fR | |
316 | Single step, but step through subroutine calls. | |
317 | .TP 5 | |
318 | .B k | |
319 | Kill the debugged program. | |
320 | .TP 5 | |
321 | procedure\fB(\fParg1,arg2,...\fB)\fP | |
322 | .br | |
323 | .ns | |
324 | .TP 5 | |
325 | procedure\fB(\fParg1,arg2,...\fB)/\fP\fIm\fP | |
326 | Execute the named procedure with the given arguments. | |
327 | Arguments can be integer, character or string constants | |
328 | or names of variables accessible from the current procedure. | |
329 | The second form causes the value returned by the procedure to be | |
330 | printed according to format \fIm\fP. | |
331 | If no format is given, it defaults to `d'. | |
332 | .TP 5 | |
333 | \fIlinenumber\fB b\fR \fIcommands\fR | |
334 | Set a breakpoint at the given line. | |
335 | If a procedure name without a line number is given (e.g. `proc:'), | |
336 | a breakpoint is placed at the first line in the procedure | |
337 | even if it was not compiled with the debug flag. | |
338 | If no \fIlinenumber\fP is given, | |
339 | a breakpoint is placed at the current line. | |
340 | .sp 0.5 | |
341 | If no | |
342 | .I commands | |
343 | are given then execution stops just before the breakpoint | |
344 | and control is returned to sdb. | |
345 | Otherwise | |
346 | the | |
347 | .I commands | |
348 | are executed when the breakpoint is | |
349 | encountered and execution continues. | |
350 | Multiple commands are specified by separating them with semicolons. | |
351 | .TP 5 | |
352 | \fIlinenumber\fB d\fR | |
353 | Delete a breakpoint at the given line. | |
354 | If no \fIlinenumber\fP is given then the breakpoints are deleted interactively: | |
355 | Each breakpoint location is printed and a line is read from the standard input. | |
356 | If the line begins with a `y' or `d' then the breakpoint is deleted. | |
357 | .TP 5 | |
358 | .B B | |
359 | Print a list of the currently active breakpoints. | |
360 | .TP 5 | |
361 | .B D | |
362 | Delete all breakpoints. | |
363 | .TP 5 | |
364 | l | |
365 | Print the last executed line. | |
366 | .TP 5 | |
367 | \fIlinenumber\fB a\fR | |
368 | Announce. | |
369 | If \fIlinenumber\fR is of the form `proc:number', the command | |
370 | effectively does a `linenumber b l'. | |
371 | If \fIlinenumber\fR is of the form `proc:', the command | |
372 | effectively does a `proc: b T'. | |
373 | .sp 1 | |
374 | .PP | |
375 | Miscellaneous commands. | |
376 | .TP 5 | |
377 | \fB! \fIcommand\fR | |
378 | The command is interpreted by sh(1). | |
379 | .TP 5 | |
380 | .B newline | |
381 | If the previous command printed a source line then | |
382 | advance the current line by 1 line and | |
383 | print the new current line. | |
384 | If the previous command displayed a core location then | |
385 | display the next core location. | |
386 | .TP 5 | |
387 | \fB"\fI string\fR | |
388 | Print the given string. | |
389 | .TP 5 | |
390 | .B q | |
391 | Exit the debugger. | |
392 | .sp 1 | |
393 | .PP | |
394 | The following commands also exist and are intended only for | |
395 | debugging the debugger. | |
396 | .TP 5 | |
397 | .B V | |
398 | Print the version number. | |
399 | .TP 5 | |
400 | .B X | |
401 | Print a list of procedures and files being debugged. | |
402 | .TP 5 | |
403 | .B Y | |
404 | Toggle debug output. | |
405 | .SH FILES | |
406 | a.out | |
407 | .br | |
408 | core | |
409 | .SH SEE\ ALSO | |
410 | adb(1) | |
411 | .SH DIAGNOSTICS | |
412 | Error reports are either identical to those of adb(1) or are | |
413 | self-explanatory. | |
414 | .SH BUGS | |
415 | If a procedure is called when the program is | |
416 | .I not | |
417 | stopped at a breakpoint | |
418 | (such as when a core image is being debugged), | |
419 | all variables are initialized before the procedure is started. | |
420 | This makes it impossible to use a procedure which formats | |
421 | data from a core image. | |
422 | .PP | |
423 | Arrays must be of one dimension and of zero origin to be correctly | |
424 | addressed by sdb. | |
425 | .PP | |
426 | The default type for printing F77 parameters is incorrect. | |
427 | Their address is printed instead of their value. | |
428 | .PP | |
429 | Tracebacks containing F77 subprograms with multiple entry points | |
430 | may print too many arguments in the wrong order, but their values | |
431 | are correct. |