r (Registers)
The r command displays or modifies registers, floating-point registers, flags, pseudo-registers, and fixed-name aliases.
User-Mode
[~Thread] r[M Mask|F|X|?] [ Register[:[Num]Type] [= [Value]] ]
r.
Kernel-Mode
[Processor] r[M Mask|F|X|Y|YI|?] [ Register[:[Num]Type] [= [Value]] ]
r.
Parameters
Processor
Specifies the processor that the registers are read from. The default value is zero. If you specify Processor, you cannot include the Register parameter--all registers are displayed. For more information about the syntax, see Multiprocessor Syntax. You can specify processors only in kernel mode.
Thread
Specifies the thread that the registers are read from. If you do not specify a thread, the current thread is used. For more information about the syntax, see Thread Syntax. You can specify threads only in user mode.
M Mask
Specifies the mask to use when the debugger displays the registers. The "M" must be an uppercase letter. Mask is a sum of bits that indicate something about the register display. The meaning of the bits depends on the processor and the mode (see the tables in the following Remarks section for more information). If you omit M, the default mask is used. You can set or display the default mask by using the Rm (Register Mask) command.
F
Displays the floating-point registers. The "F" must be an uppercase letter. This option is equivalent to M 0x4.
X
Displays the SSE XMM registers. This option is equivalent to M 0x40.
Y
Displays the AVX YMM registers. This option is equivalent to M 0x200.
YI
Displays the AVX YMM integer registers. This option is equivalent to M 0x400.
Z
Displays the AVX-512 YMM registers (zmm0-zmm31) in floating point format.
ZI
Displays the AVX-512 YMM registers (zmm0-zmm31) in integer format.
K
Display the AVX-512 Opmask predicate registers (K0-K7).
?
(Pseudo-register assignment only) Causes the pseudo-register to acquire typed information. Any type is permitted. For more information about the r? syntax, see Debugger Command Program Examples.
Register
Specifies the register, flag, pseudo-register, or fixed-name alias to display or modify. You must not precede this parameter with at (@) sign. For more information about the syntax, see Register Syntax.
Num
Specifies the number of elements to display. If you omit this parameter but you include Type, the full register length is displayed.
Type
Specifies the data format to display each register element in. You can use Type only with 64-bit and 128-bit vector registers. You can specify multiple types.
You can specify one or more of the following values.
Type | Display format |
---|---|
ib |
Signed byte |
ub |
Unsigned byte |
iw |
Signed word |
uw |
Unsigned word |
id |
Signed DWORD |
ud |
Unsigned DWORD |
iq |
Signed quad-word |
uq |
Unsigned quad-word |
f |
32-bit floating-point |
d |
64-bit floating-point |
Value
Specifies the value to assign to the register. For more information about the syntax, see Numerical Expression Syntax.
.
Displays the registers used in the current instruction. If no registers are used, no output is displayed.
Environment
Item | Description |
---|---|
Modes | User mode, kernel mode |
Targets | Live, crash dump |
Platforms | All |
Additional Information
For more information about the register context and other context settings, see Changing Contexts.
Remarks
If you do not specify Register, the r command displays all the non-floating-point registers, and the rF command displays all the floating-point registers. You can change this behavior by using the rm (Register Mask) command.
If you specify Register but you omit the equal sign (=) and the Value parameter, the command displays the current value of the register.
If you specify Register and an equal sign (=) but you omit Value, the command displays the current value of the register and prompts for a new value.
If you specify Register, the equal sign (=), and Value, the command changes the register to contain the value. (If quiet mode is active, you can omit the equal sign. You can turn on quiet mode by using the sq (Set Quiet Mode) command. In kernel mode, you can also turn on quiet mode by using the KDQUIET environment variable.)
You can specify multiple registers, separated by commas.
In user mode, the r command displays registers that are associated with the current thread. For more information about the threads, see Controlling Processes and Threads.
In kernel mode, the r command displays registers that are associated with the current register context. You can set the register context to match a specific thread, context record, or trap frame. Only the most important registers for the specified register context are actually displayed, and you cannot change their values. For more information about register context, see Register Context.
When you specify a floating-point register by name, the F option is not required. When you specify a single floating-point register, the raw hexadecimal value is displayed in addition to the decimal value.
The following Mask bits are supported for an x86-based processor or an x64-based processor.
Bit | Value | Description |
---|---|---|
0 1 | 0x1 0x2 | Displays the basic integer registers. (Setting one or both of these bits has the same effect.) |
2 |
0x4 |
Displays the floating-point registers. |
3 |
0x8 |
Displays the segment registers. |
4 |
0x10 |
Displays the MMX registers. |
5 |
0x20 |
Displays the debug registers. In kernel mode, setting this bit also displays the CR4 register. |
6 |
0x40 |
Displays the SSE XMM registers. |
7 |
0x80 |
(Kernel mode only) Displays the control registers, for example CR0, CR2, CR3 and CR8. |
8 |
0x100 |
(Kernel mode only) Displays the descriptor and task state registers. |
9 |
0x200 |
Displays the AVX YMM registers in floating point. |
10 |
0x400 |
Displays the AVX YMM registers in decimal integers. |
11 |
0x800 |
Displays the AVX XMM registers in decimal integers. |
The following code examples show r commands for an x86-based processor.
In kernel mode, the following command shows the registers for processor 2.
1: kd> 2r
In user mode, the following command shows the registers for thread 2.
0:000> ~2 r
In user mode, the following command displays all of the eax registers that are associated with all threads (in thread index order).
0:000> ~* r eax
The following command sets the eax register for the current thread to 0x000000FF.
0:000> r eax=0x000000FF
The following command sets the st0 register to 1.234e+10 (the F is optional).
0:000> rF st0=1.234e+10
The following command displays the zero flag.
0:000> r zf
The following command displays the xmm0 register as 16 unsigned bytes and then displays the full contents of the xmm1 register in double-precision floating-point format.
0:000> r xmm0:16ub, xmm1:d
If the current syntax is C++, you must precede registers by an at sign (@). Therefore, you could use the following command to copy the ebx register to the eax register.
0:000> r eax = @ebx
The following command displays pseudo-registers in the same way that the r command displays registers.
0:000> r $teb
You can also use the r command to create fixed-name aliases. These aliases are not registers or pseudo-registers, even though they are associated with the r command. For more information about these aliases, see Using Aliases.
Here is an example of the r. command on an x86-based processor. The last entry of the call stack precedes the command itself.
01004af3 8bec mov ebp,esp
0:000> r.
ebp=0006ffc0 esp=0006ff7c