.frame (Set Local Context)

The .frame command specifies which local context (scope) is used to interpret local variables or displays the current local context.

.frame [/c] [/r] [FrameNumber] 
.frame [/c] [/r] = BasePtr [FrameIncrement] 
.frame [/c] [/r] = BasePtr StackPtr InstructionPtr 

Parameters

/c
Sets the specified frame as the current local override context. This action allows a user to access the nonvolatile registers for any function in the call stack.

/r
Displays registers and other information about the specified local context.

FrameNumber
Specifies the number of the frame whose local context you want. If this parameter is zero, the command specifies the current frame. If you omit this parameter, this command displays the current local context.

BasePtr
Specifies the base pointer for the stack trace that is used to determine the frame, if you add an equal sign (=) after the command name (.frame). On an x86-based processor, you add another argument after BasePtr (which is interpreted as FrameIncrement) or two more arguments after BasePtr (which are interpreted as InstructionPtr and StackPtr).

FrameIncrement
(x86-based processor only)

Specifies an additional quantity of frames past the base pointer. For example, if the base pointer 0x0012FF00 is the address of frame 3, the command .frame 12ff00 is equivalent to .frame 3, and .frame 12ff00 2 is equivalent to .frame 5.

StackPtr
(x86-based processor only) Specifies the stack pointer for the stack trace that is used to determine the frame. If you omit StackPtr and InstructionPtr, the debugger uses the stack pointer that the esp register specifies and the instruction pointer that the eip register specifies.

InstructionPtr
(x86-based processor only) Specifies the instruction pointer for the stack trace that is used to determine the frame. If you omit StackPtr and InstructionPtr, the debugger uses the stack pointer that the esp register specifies and the instruction pointer that the eip register specifies.

Environment

Item Description
Modes User mode, kernel mode
Targets Live, crash dump
Platforms All

Additional Information

For more information about the local context and other context settings, see Changing Contexts. For more information about how to display local variables and other memory-related commands, see Reading and Writing Memory.

Remarks

When an application is running, the meaning of local variables depends on the location of the program counter, because the scope of such variables extends only to the function that they are defined in. If you do not use the .frame command, the debugger uses the scope of the current function (the current frame on the stack) as the local context.

To change the local context, use the .frame command and specify the frame number that you want.

The frame number is the position of the stack frame within the stack trace. You can view this stack trace with the k (Display Stack Backtrace) command or the Calls window. The first line (the current frame) is frame number 0. The subsequent lines represent frame numbers 1, 2, 3, and so on.

If you use the n parameter with the k command, the k command displays frame numbers together with the stack trace. These frame numbers are always displayed in hexadecimal form. On the other hand, the .frame command interprets its argument in the default radix, unless you override this setting with a prefix such as 0x. To change the default radix, use the n (Set Number Base) command.

You can set the local context to a different stack frame to enable you to view new local variable information. However, the actual variables that are available depend on the code that is being executed.

The local context is reset to the scope of the program counter if any application execution occurs. The local context is reset to the top stack frame if the register context is changed.