Sun Studio 12:使用 dbx 调试程序

语法

list

列出 N 行。

list number

列出行号为 number 的行。

list +

列出后 N 行。

list +n

列出后 n 行。

list -

列出前 N 行。

list

列出前 n 行。

list n1, n2

列出第 n1 行到第 n2 行。

list n1, +

列出第 n1 行到第 n1 + N 行。

list n1, +n2

列出第 n1 行到第 n1 + n2 行。

list n1, -

列出第 n1-N 行到第 n1 行。

list n1, -n2

列出第 n1-n2 行到第 n1 行。

list function

列出 function 源的开头。list function 将更改当前范围。有关更多信息,请参见程序作用域

list file_name

列出文件 file_name 的开头。

list file_name: n

列出文件 filename 中从第 n 行开始的内容。适当时,行号可能为 "$",表示文件的最后一行。逗号是可选的。

其中:

file_name 是源代码文件的名称。

function 是要显示的函数名。

number 是源文件中的行号。

n 是要显示的行数。

n1 是要显示的第一行的编号。

n2 是要显示的最后一行的编号。

选项

-i-instr

混合源代码行和汇编代码。

-w-wn

列出行或函数前后 N(或 n)行(范围)。此选项不能与 "+" 或 "-" 语法一起使用,指定了两个行号时,也不允许使用此选项。

-a

如果与函数一起使用,则列出整个函数。如果使用时不带参数,则列出当前访问函数的剩余部分(如果有)。

示例

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