The simplest way to see a source file 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, which can be defined by following way:
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.
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 correspondently.
The line in arguments can be specified by following way:
User can specify a source file name for arguments given
in form integer number
and function by
following way:
filename:integer_number and filename:function.
For example, to list lines 16 through 20:
(idb) list 16, 20
16
17 class Node {
18 public:
19 Node ();
20
(idb) list 16,20
16
17 class Node {
18 public:
19 Node ();
20
For example, to list 6 lines, beginning with line 16:
(idb) list 16:6
16
17 class Node {
18 public:
19 Node ();
20
21 virtual void printNodeData() const = 0;
(idb) list 16,+6
16
17 class Node {
18 public:
19 Node ();
20
21 virtual void printNodeData() const = 0;