dwhere
Displays the current execution location and call stack
Format
Displays locations in the call stack
dwhere [ -level start-level ] [ num-levels | -all ] [-a | -args ] [ -no_args [ -locals ] [-no_locals] [ -registers] [-no_registers] [-fp_registers] [-no_fp_registers] [-show_pc] [ -noshow_pc ] [-show_fp] [ -noshow_fp ][ -show_image ] [-noshow_image] [-group_by property]
Displays all locations in the call stack
dwhere -all[ -args ] [-locals ] [-registers ] [ -noshow_pc ][ -noshow_fp ][ -show_image ]
Arguments
-all
Shows all levels of the call stack. This is the default.
-level | -l start-level
Sets the level at which dwhere starts displaying information. Frame levels start from 0, and this is the default.
num-levels
Restricts output to this number of levels of the call stack. Defaults to the value of debugger state variable MAX_LEVELS.
-args | -a
Displays argument names and values in addition to program location information. By default, the arguments are not shown.
-no_args
Does not display argument names and values with program location information. This is the default.
-locals
Displays each frame’s local variables as well as program location information. This option also displays the arguments to the function as well unless the -no_args option is specified. By default, the local variable information is not shown.
-no_locals
Does not display each frame’s local variables with program location information. This is the default.
-show_pc
Displays the program counter (PC) value in the program location information. This is the default.
-no_show_pc
Does not show the PC. By default, the PC value is shown.
-show_fp
Displays the frame pointer (FP) value in the program location information. This is the default.
-no_show_fp
Does not show the FP. This may be useful when comparing dwhere output. By default, the FP value is shown.
-registers
Displays each frame’s registers with program location information. By default, the register information is not shown.
-no_registers
Does not display each frame’s registers. This is the default.
-fp_registers
Displays the floating point registers and their values as well as program location information. By default, the floating point register information is not shown.
-no_fp_registers
Does not display the floating point registers. This is the default.
-show_image
Displays the associated image at the location, if the source line cannot be found. This is the default.
-no_show_image
Does not display the associated image at the location when the source line cannot be found. This may be useful when comparing dwhere output. By default, dwhere displays the associated image information if the source line cannot be found.
-group_by| -g property
Aggregates stack backtraces of the focus threads, outputting a compressed
ptlist that identifies the processes and threads containing equivalent stack frames in the backtrace. For information on the
ptlist syntax, see
Compressed List Syntax (ptlist)or type “
help ptlist” in the CLI.
This option requires a property argument to control the “equivalence” relationship of stack frames across the threads. See “The -group_by Option” below for more information.
Description
The dwhere command prints the current execution locations and the call stacks—or sequences of procedure calls—that led to that point. The CLI shows information for threads in the current focus; the default shows information at the thread level.
Arguments control the amount of command output in two ways:
The
num-levels argument determines how many levels of the call stacks are displayed, counting from the uppermost (most recent) level. Without this argument, the CLI shows all levels in the call stack, which is the default.
The
-a option displays procedure argument names and values for each stack level.
A dwhere command with no arguments or options displays the call stacks for all threads in the target set.
The
MAX_LEVELSvariable contains the default maximum number of levels displayed when you do not use the
num-levels argument.
The dwhere command displays the current execution location(s) and the backtrace(s) for the threads in the current focus, defaulting to thread level. If backtraces for multiple threads are requested, the stack displays are aggregated.
Lines denoting evaluation frames for compiled expressions or interpreted function calls are labeled with a suspended evaluation id. This id can be used to manipulate suspended evaluations with dflush and TV::expr.
Output is generated for each thread in the target focus. The output is printed directly to the console.
The -group_by Option
The -group_by option requires a property argument, which controls the “equivalence” relationship of stack frames across the threads. When you use the --group_by option, dwhere aggregates the stack frames of each of the focus threads, forming a tree of equivalent stack frames.
Starting at the base of the stack (closest to main() or the thread's start function), the dwhere command assigns each frame a distance from a synthetic root frame indicated by /. Two frames are equivalent only if all of the following apply:
Their distance from the root is equal.
They have the same parent frame.
The selected property of frames is equivalent.
The following property values are supported, with their abbreviations in parentheses:
function (f): Equivalence based on the name of the function containing the PC for the frame.
function+line (f+l): Equivalence based on the name of the function and the file and line number containing the PC for the frame.
function+offset (f+o): Equivalence based on the name of the function containing the PC for the frame and offset from the beginning of the function to the PC for the frame.
Looking at backtraces purely by the function property is the most coarse grained grouping of threads. Choosing a more fine-grained grouping, such as a line number within the function, provides more detail about where in the code a given thread is executing, but it may also result in a much larger set of equivalent frames.
Command alias
Alias | Definition | Description |
---|
w | dwhere | Displays the current location in the call stack |
Examples
dwhere
Displays the call stacks for all threads in the current focus.
dfocus 2.1 dwhere 1
Displays just the most recent level of the call stack corresponding to thread 1 in process 2. This shows just the immediate execution location of a thread or threads.
f p1.< w 5
Displays the most recent five levels of the call stacks for all threads involved in process 1. If the depth of any call stack is less than five levels, all of its levels are shown.
This command is a slightly more complicated way of saying f p1 w 5 because specifying a process width tells the dwhere command to ignore the thread indicator.
w 1 -a
Displays the current execution locations (one level only) of threads in the current focus, together with the names and values of any arguments that were passed into the current process.
Related Topics