Debugging Tools for Windows |
The debugger engine can be used to examine and alter the target's registers.
The registers available on the target depend on its processor architecture. For a description of the registers for the x86 and Itanium processors, see Processor Architecture. For a complete description of the registers available for a processor, see that processor's documentation.
The GetNumberRegisters method can be used to find the number of registers on the target.
Each register is referred to by its index. The index of the first register is zero, and the index of the last register is the number of registers minus one. To find the index of a register whose name is known, use GetIndexByName.
The method GetDescription returns information about a register. This includes the register's name, the type of values it can hold, and whether it is a subregister.
A subregister is a register that is contained within another register. When the subregister changes, the register that contains it also changes. For example, on an x86 processor, the ax subregister is the same as the low 16 bits of the 32-bit eax register.
There are three special registers whose values may be found by using the following methods. The interpretation of the values of these registers is platform dependent.
The value of a register can be read by using the method GetValue. Multiple registers can be read by using GetValues and GetValues2.
A value can be written to a register by using the method SetValue. Multiple registers can be written by using SetValues and SetValues2.
When writing a value to a register, if the value supplied has a different type to the type of the register then the value is converted into the register's type. This conversion is the same as that performed by the method CoerceValue. This conversion may result in data loss if the register's type is not capable of holding the value supplied.
Pseudo-registers are variables maintained by the debugger engine that hold certain values, for example, $teb is the name of the pseudo-register whose value is the address of the current thread's Thread Environment Block (TEB). For more information, and a list of the pseudo-registers, see Pseudo-Register Syntax.
Each pseudo-register has an index. The index is a number between zero and the number of pseudo-registers – (returned by GetNumberPseudoRegisters) minus one. To find the index of a pseudo-register by its name, use GetPseudoIndexByName. The values of pseudo-registers can be read using GetPseudoValues, and values can be written to pseudo-registers using SetPseudoValues. For a description of a pseudo-register, including its type, use GetPseudoDescription.
Note Not all of the pseudo-registers are available in all debugging sessions or at all times in a particular session.
The methods OutputRegisters and OutputRegisters2 format the target's registers and sends them to the clients as output.
Whenever the values of the target's registers change, the engine will call the IDebugEventCallbacks::ChangeDebuggeeState callback method with the parameter Flags set to DEBUG_CDS_REGISTERS.