Debugging Tools for Windows
r (Registers)
The r command displays or modifies registers, floating-point registers, flags, pseudo-registers, and fixed-name aliases.
Syntax
User-Mode
[~Thread] r[M Mask|F|X|?] [ Register[:[Num]Type] [= [Value]] ]
r.
Kernel-Mode
[Processor] r[M Mask|F|X|?] [ 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 Comments 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. The "X" must be an uppercase letter. This option is equivalent to M 0x40.
- ?
- (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
| Modes | User mode, kernel mode |
| Targets | Live, crash dump |
| Platforms | All |
Comments
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 CR0, CR1, and CR3 registers. |
| 8 | 0x100 | (Kernel mode only) Displays the descriptor and task state registers. |
The following Mask bits are supported for an Itanium-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 high, floating-point registers (f32 to f127). |
| 4 | 0x10 | Displays the user debug registers. |
| 5 | 0x20 | (Kernel mode only) Displays the KSPECIAL_REGISTERS. |
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
The following command displays all of the eax registers that are associated with all threads (in thread ordinal 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
Here is an example of the r. command on an Itanium-based processor.
e0000000`83066cf0 ld8.acq r25 = [r45] e0000000`ffff0b18=????????????????
1: kd> r.
r25=ffffffff`d0000006 r45=e0000000`ffff0b18
Additional Information
For more information about registers and their manipulation, see Reading and Writing Registers and Flags. For more information about the register context and other context settings, see Changing Contexts.
Build machine: CAPEBUILD