DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
sdb: symbolic debugger

Displaying the source file

Four commands exist for displaying lines in the source file. They are useful for perusing the source program and determining the context of the current line. The commands are as follows:


p
prints the current line

w
window; prints a window of ten lines around the current line

z
prints ten lines starting at the current line; advances the current line by ten

control-d
scrolls; prints the next ten lines and advances the current line by ten; used to display cleanly long segments of the program

When a line from a file is printed, it is preceded by its line number. This not only gives an indication of its relative position in the file, but it is also used as input by some sdb commands.

Changing the current source file or function

The e command is used to change the current source file.

   *e function
   *e file.c
Either of above forms may be used. The first causes the file containing the named function to become the current file, and the current line becomes the first line of the function. The other form causes the named file to become current. In this case, the current line is set to the first line of the named file. Finally, an e command with no argument causes the current function and file named to be printed.

Changing the current line in the source file

The z and control-d commands have a side effect of changing the current line in the source file. The following paragraphs describe other commands that change the current line. There are two commands for searching for instances of regular expressions in source files. They are:

   */regular expression/
   *?regular expression?
The first command searches forward through the file for a line containing a string that matches the regular expression, and the second searches backwards. The trailing / and ? may be omitted from these commands. Regular expression matching is identical to that of ed(C).

The + and - commands may be used to move the current line forward or backward by a specified number of lines. Typing a new-line advances the current line by one, and typing a number causes that line to become the current line in the file. These commands may be combined with the display commands so that, the following advances the current line by 15 and then prints ten lines.

   *+15z

Next topic: A controlled environment for program testing
Previous topic: Source file display and manipulation

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003