Sun Studio 12 Update 1: Debugging a Program With dbx

Syntax

list

List N lines.

list number

List line number number.

list +

List next N lines.

list +n

List next n lines.

list -

List previous N lines.

list

List previous n lines.

list n1, n2

List lines from n1 to n2.

list n1, +

List from n1 to n1 + N.

list n1, +n2

List from n1 to n1 + n2.

list n1, -

List from n1-N to n1.

list n1, -n2

List from n1-n2 to n1.

list function

List the start of the source for function. list function changes the current scope. See Program Scope for more information.

list file_name

List the start of the file file_name.

list file_name:n

List file filename from line n.

where:

file_name is the file name of a source code file.

function is the name of a function to display.

number is the number of a line in the source file.

n is a number of lines to display.

n1 is the number of the first line to display.

n2 is the number of the last line to display. Where appropriate, the line number can be ”$” which denotes the last line of the file. Comma is optional.

Options

-i or -instr

Intermix source lines and assembly code.

-w or -wn

List N (or n) lines (window) around line or function. This option is not allowed in combination with the ”+” or ”-” syntax or when two line numbers are specified.

-a

When used with a function name, lists the entire function. When used without parameters, lists the remains of the current visiting function, if any.

Examples

list                      // list N lines starting at current line
list +5                      // list next 5 lines starting at current line
list -                    // list previous N lines
list -20                  // list previous 20 lines
list 1000                 // list line 1000
list 1000,$               // list from line 1000 to last line
list 2737 +24             // list line 2737 and next 24 lines
list 1000 -20             // list line 980 to 1000
list test.cc:33           // list source line 33 in file test.cc
list -w                   // list N lines around current line
list -w8 ”test.cc”func1   // list 8 lines around function func1
list -i 500 +10                // list source and assembly code for line
                500 to line 510