list[>] [filename] [first [number]]
list[>] location [number]
List Perl source code.
Without arguments, prints lines centered around the current line. If this is the first list command issued since the debugger command loop was entered, then the current line is the current frame. If a subsequent list command was issued with no intervening frame changing, then that is start the line after we last one previously shown.
If the command has a '>' suffix, then line centering is disabled and listing begins at the specificed location.
The number of lines to show is controlled by the debugger "listsize" setting.
set max list or
show max list to see or set the value.
A location is a either:
a '-' for the lines before the current line number
If the location form is used with a subsequent parameter, the parameter is the starting line number. When there two numbers are given, the last number value is treated as a stopping line unless it is less than the start line, in which case it is taken to mean the number of lines to list instead.
list 5 # List centered around line 5 list 5> # List starting at line 5 list foo.rb 5 # Same as above. list foo.rb 5 6 # list lines 5 and 6 of foo.rb list foo.rb 5 2 # Same as above, since 2 < 5. list FileUtils.cp # List lines around the FileUtils.cp function. list . # List lines centered from where we currently are stopped list . 3 # List 3 lines starting from where we currently are stopped # if . > 3. Otherwise we list from . to 3. list - # List lines previous to those just shown
The output of the list command give a line number, and some status information about the line and the text of the line. Here is some hypothetical list output modeled roughly around line 251 of one version of this code:
251 cmd.proc.frame_setup(tf) 252 -> brkpt_cmd.run(['break']) 253 B01 line = __LINE__ 254 b02 cmd.run(['list', __LINE__.to_s]) 255 t03 puts '--' * 10
Line 251 has nothing special about it. Line 252 is where we are currently stopped. On line 253 there is a breakpoint 1 which is enabled, while at line 255 there is an breakpoint 2 which is disabled.