|
|
Breakpoints can be set at any line in a function compiled with the -g option. The command format is as follows:
*12b *proc:b *bThe first form sets a breakpoint at line 12 in the current file. The line numbers are relative to the beginning of the file as printed by the source-file display commands. The second sets a breakpoint at the first line of proc. The last sets a breakpoint at the current line.
Similarly, breakpoints are deleted with the d command:
*12d *proc:12d *proc:dIn addition, if the command d is given alone, the breakpoints are deleted interactively. Each breakpoint location is printed, and a line is read from the user. If the line begins with a y or a d, the breakpoint is deleted.
The B command prints a list of the current breakpoints and the D command deletes all breakpoints. It is sometimes desirable to have sdb automatically perform a sequence of commands at a breakpoint and then have execution continue. This is achieved with another form of the b command:
*12b t;x/This causes both a trace back and the value of x to be printed each time execution gets to line 12. The a command is a variation of the above command. There are two forms:
*proc:a *proc:12aThe first prints the function name and its arguments each time it is called, and the second prints the source line each time it is about to be executed. For both forms of the a command, execution continues after the function name or source line is printed.