dlist
Displays source code lines
Format
Displays source code relative to the current list location
dlist [ -n num-lines ]
Displays source code relative to a named place
dlist breakpoint-expr [ -n num-lines ]
Displays source code relative to the current execution location
dlist -e [ -n num-lines ]
Arguments
-n num-lines
Displays this number of lines rather than the default number. (The default is the value of the MAX_LIST variable.) If num-lines is negative, the CLI displays lines before the current location, and additional dlist commands show preceding lines in the file rather than following lines.
This option also sets the value of the MAX_LIST variable to num-lines.
breakpoint-expr
The location at which the CLI begins displaying information. In most cases, specify this location as a line number or as a string that contains a file name, function name, and line number, each separated by # characters; for example: file#func#line.
If you enter a different file, it is used for future display. This means that if you want to display information relative to the current thread’s execution point, use the -e option to dlist.
If the breakpoint expression evaluates to more than one location, TotalView chooses one.
For other ways to enter these expressions, see
"Breakpoint Expressions". If you name more than one address, TotalView picks one.
-e
Sets the display location to include the current execution point of the thread of interest(TOI). If you use 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 source code lines relative to a source code location, called the list location. The CLI prints this information; it is not returned. If you do not specify source-loc or -e, the command continues where the previous list command stopped. To display the thread’s execution point, use the dlist -e command.
If you enter a file or procedure name, the listing begins at the file or procedure’s first line.
The default focus for this command is thread level. If your focus is at process level, TotalView acts on each thread in the process.
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_WIDTH variable controls the tab stop width, which defaults to 8. If TAB_WIDTH is set to -1, no tab processing is performed, and the CLI displays tabs using their ASCII value.
All lines appear 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 the
dwhere command that indicates the selected frame.
Here are some general rules:
• The initial display location is main().
• The CLI sets the display location 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 variable.
Command alias
Alias | Definition | Description |
l | dlist | Displays lines |
Examples
The following examples assume that the MAX_LIST variables equals 20, which is its initial value.
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 that corresponds to the current list location. Because this uses an explicit value, 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; shows 50 lines, ending with the current source code location. The list location is decremented by 50.
dlist do_it
Displays 20 lines in procedure do_it. Changes the list location to be the 20th line of the procedure.
dfocus 2.< dlist do_it
Displays 20 lines in the do_it routine associated with process 2. If the current source file is named foo, you can also specify this 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 it displays 10 lines.
dlist do_it.f#80 -n 10
Displays 10 lines, starting with line 80 in file do_it.f. Updates the list location to line 90.