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