list subcommand for dbx: Display lines of the current source file

Format

list [procedure | SourcelineExpression] [,SourcelineExpression]

Description

The list subcommand displays a specified number of lines in the source file. The number of lines displayed are specified in one of two ways:
  • By specifying a procedure using the procedure argument. In this case, the list subcommand displays lines before the first executable line of source in the specified procedure and until the list window is filled.
  • By specifying a starting and ending source line number using the SourcelineExpression argument. Use the current filename or source filename if specified.

    The SourcelineExpression argument should consist of a valid line number followed by an optional + or - and an integer. In addition, a SourcelineExpression of $ can be used to denote the current line number, and a SourcelineExpression of @ can be used to denote the next line number to be listed.

    All lines from the first line number specified to the second line number specified, inclusive, are then displayed, provided these lines fit in the list window.

    If the second source line is omitted, ten lines are printed, beginning with the line number specified in the SourcelineExpression argument.

If the list subcommand is used without arguments, the default number of lines are printed, beginning with the current source line. The default is 10.

To change the number of lines to list by default, set the special debug program variable, $listwindow, to the number of lines you want. Initially, $listwindow is set to 10.

Usage notes

The list subcommand can be run only while the dbx debug program is running.

Examples

  1. To list the lines 1 through 10 in the current file, enter:
    list 1,10
  2. To list 10, or $listwindow, lines around the first executable line in the main procedure, enter:
    list main
  3. To list 11 lines around the current line, enter:
    list $-5,$+5

Related information

The edit, listi, move, and set subcommands.