pt (Step to Next Return)

The pt command executes the program until a return instruction is reached.

User-Mode

[~Thread] pt [r] [= StartAddress] [Count] ["Command"]

Kernel-Mode

pt [r] [= StartAddress] [Count] ["Command"]

Parameters

Thread
Specifies threads to continue executing. All other threads are frozen. For more information about the syntax, see Thread Syntax. You can specify threads only in user mode.

r
Turns on and off the display of registers and flags. By default, the registers and flags are displayed. You can disable register display by using the ptr, pr, tr, or .prompt_allow -reg commands. All of these commands control the same setting and you can use any of them to override any previous use of these commands.

You can also disable register display by using the l-os command. This setting is separate from the other three commands. To control which registers and flags are displayed, use the rm (Register Mask) command.

StartAddress
Specifies the address where the debugger begins execution. Otherwise, the debugger begins at the instruction that the instruction pointer points to. For more information about the syntax, see Address and Address Range Syntax.

Count
Specifies the number of return instructions that must be encountered for this command to stop. The default value is one.

Command
Specifies a debugger command to execute after the step is performed. This command is executed before the standard pt results are displayed. If you also use Count, the specified command is executed after all stepping is complete (but before the results from the final step are displayed).

Environment

Item Description
Modes user mode, kernel mode
Targets live debugging only
Platforms all

Additional Information

For more information about related commands, see Controlling the Target.

Remarks

The pt command causes the target to begin executing. This execution continues until a return instruction is reached or a breakpoint is encountered.

If the program counter is already on a return instruction, the entire return is executed. After this return is returned, execution continues until another return is reached. This execution, rather than tracing, of the call is the only difference between pt and tt (Trace to Next Return).

In source mode, you can associate one source line with multiple assembly instructions. The pt command does not stop at a return instruction that is associated with the current source line.

The following example demonstrates using the pt command along with the kb command to display the stack trace:

0:000> pt "kb"