Sun Studio 12: Debugging a Program With dbx

list Command

The list command displays lines of a source file. It has identical syntax and identical functionality in native mode and in Java mode.

The default number of lines listed, N, is controlled by the dbx output_list_size environment variable.



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 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 appropriate, the line number may be ”$” which denotes the last line of the file. Comma is optional.


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.


-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.


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


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           // list source line 33 in file
list -w                   // list N lines around current line
list -w8 ””func1   // list 8 lines around function func1
list -i 500 +10                // list source and assembly code for line
                500 to line 510