dlist
Displays source code lines
Format:
Displays code relative to the current list location
dlist [
-n num-lines ]
Displays code relative to a named place
dlist source-loc [ -n num-lines ]
Displays code relative to the current execution location
dlist -e [ -n num-lines ]
Arguments:
-n num-lines
Requests that this number of lines be displayed rather than the default value. (The default is the value of the MAX_LIST variable.) If num-lines is negative, lines before the current location are shown, and additional dlist commands will show preceding lines in the file rather than succeeding lines. For more information, see dset.
This option also sets the value of the MAX_LIST variable to num-lines.
source-loc
Sets the location at which the CLI begins displaying information. This location is specified as a line number or as a string containing a file name, function name, and line number, each separated by # characters. For example: file#func#line. For more information, see Qualifying Symbol Names. Defaults are constructed if you omit parts of this specification.
-e
Sets the display location to include the current execution point of the thread of interest. If you used dup and ddown commands to select a buried stack frame, this location includes the PC (program counter) for that stack frame.
Description:
The dlist command displays lines relative to a place in the source code. (This position is called the list location.) The CLI prints this information; it is not returned. If neither source-loc nor -e is specified, the command continues where the previous list command left off. To display the thread's execution point, use dlist -e.
If you enter a file or procedure name, the listing begins at the file or procedure's first line.
The first time you use the dlist command after you focus on a different thread--or after the focus thread runs and stops again--the location changes to include the current execution point of the new focus thread.
Tabs in the source file are expanded as blanks in the output. The tab stop width is controlled by the TAB_WIDTH variable, which has a default value of 8. If TAB_WIDTH is set to -1, no tab processing is done, and tabs are displayed using their ASCII value.
All lines are shown with a line number and the source text for the line. The following symbols are also used:
@
An action point is set at this line.
>
The PC for the current stack frame is at the indicated line and this is the leaf frame.
=
The PC for the current stack frame is at the indicated line and this is a buried frame; this frame has called another function so that this frame is not the active frame.
These correspond to the marks shown in the backtrace displayed by dwhere that indicates the selected frame.
Here are some general rules:
- The initial display location is main().
- The display location is set to the current execution location when the focus is on a different thread.
If the source-loc argument is not fully qualified, the CLI looks for it in the directories named in the CLI EXECUTABLE_PATH state variable.
Command alias:
You may find the following alias useful:
Alias |
Definition |
Meaning |
l |
{dlist} |
Displays lines |
Examples:
These examples assume that MAX_LIST is at its initial value of 20.
dlist
Displays 20 lines of source code, beginning at the current list location. The list location is incremented by 20 when the command completes.
dlist 10
Displays 20 lines, starting with line 10 of the file corresponding to the current list location. Because an explicit value was used, the CLI ignores the previous command. The list location is changed to line 30.
dlist -n 10
Displays 10 lines, starting with the current list location. The value of the list location is incremented by 10.
dlist -n -50
Displays source code preceding the current list location; 50 lines are shown, ending with the current source code location. The list location is decremented by 50.
dlist do_it
Displays 20 lines in procedure do_it. The list location is changed so that it is the 20th line of the procedure.
dfocus 2.< dlist do_it
Displays 20 lines in the routine do_it associated with process 2. If the current source file were named foo, this could also be specified as dlist foo#do_it, naming the executable for process 2.
dlist -e
Displays 20 lines starting 10 lines above the current execution location.
f 1.2 l -e
Lists the lines around the current execution location of thread 2 in process 1.
dfocus 1.2 dlist -e -n 10
Produces essentially the same listing as the previous example, differing in that 10 lines are displayed.
dlist do_it.f#80 -n 10
Displays 10 lines, starting with line 80 in file do_it.f. The list location is updated to line 90.