The simplest way to see a source file in the DBX mode is to use a text editor. The edit command will display an editor on the current file, using the current definition of the EDITOR environment variable, if there is one.
However, some primitive inspection capabilities are built into the debugger. The list command displays source lines, as specified by one of the following items:
GDB Mode
list_source_file_command
: list [ [+ | -] line_expression ] [ , [ [+ | -]
line_expression ] ]
| list function
If a function name or the only one line_expression is specified as the single argument then lines centered around
the function beginning or specified line are printed.
Commands list + and
list - print some
lines after and before the last printed correspondingly.
The argument to list can be specified in the following three ways:
The last line printed
Specified program address
User can specify a source file-name for a line number or for a function-name argument to list by prepending the file-name to the number or function-name separated by a colon:
filename:integer_number
filename:function.
DBX Mode
list_source_file_command
: list [ line_expression ]
| list line_expression , line_expression
| list line_expression : line_expression
line_expression
If specified, the first expression must evaluate to either an integer (the line number of the first line to display within the current source file) or a function (the first line of the function).
Specify the exact range of source lines as either a comma followed by the expression for the last line, or a colon followed by the expression for the number of lines. This second expression must evaluate to an integer value.
If a second expression is not given, the debugger shows 20 lines, fewer if the end of source file is reached.
For example, to list lines 16 through 20:
GDB Mode
(idb) list 16,20
16
17 class Node {
18 public:
19 Node ();
20
DBX Mode
(idb) list 16, 20
16
17 class Node {
18 public:
19 Node ();
20
For example, to list 6 lines, beginning with line 16:
GDB Mode
(idb) list 16,+6
16
17 class Node {
18 public:
19 Node ();
20
21 virtual void printNodeData() const = 0;
DBX Mode
(idb) list 16:6
16
17 class Node {
18 public:
19 Node ();
20
21 virtual void printNodeData() const = 0;