X86 debug register
On the x86 architecture, a debug register is a register used by a processor for program debugging.[src] There are six debug registers, named DR0...DR7, with DR4 and DR5 as obsolete synonyms for DR6 and DR7.[src] The debug registers allow programmers to selectively enable various debug conditions associated with a set of four debug addresses.[src] Two of these registers are used to control debug features.[src] These registers are accessed by variants of the MOV instruction.[src] A debug register may be either the source operand or destination operand.[src] The debug registers are privileged resources; the MOV instructions that access them can only be executed at privilege level zero.[src] An attempt to read or write the debug registers when executing at any other privilege level causes a general protection fault.[src]
On the x86 architecture, a debug register is a register used by a processor for program debugging.[src] There are six debug registers, named DR0...DR7, with DR4 and DR5 as obsolete synonyms for DR6 and DR7.[src] The debug registers allow programmers to selectively enable various debug conditions associated with a set of four debug addresses.[src] Two of these registers are used to control debug features.[src] These registers are accessed by variants of the MOV instruction.[src] A debug register may be either the source operand or destination operand.[src] The debug registers are privileged resources; the MOV instructions that access them can only be executed at privilege level zero.[src] An attempt to read or write the debug registers when executing at any other privilege level causes a general protection fault.[src] ==DR0 to DR3== Each of these registers contains the linear address associated with one of four breakpoint conditions.[src] Each breakpoint condition is further defined by bits in DR7.[src] The debug address registers are effective whether or not paging is enabled.[src] The addresses in these registers are linear addresses.[src] If paging is enabled, the linear addresses are translated into physical addresses by the processor's paging mechanism.[src] If paging is not enabled, these linear addresses are the same as physical addresses.[src] Note that when paging is enabled, different tasks may have different linear-to-physical address mappings.[src] When this is the case, an address in a debug address register may be relevant to one task but not to another.[src] For this reason the x86 has both global and local enable bits in DR7.[src] These bits indicate whether a given debug address has a global (all tasks) or local (current task only) relevance.[src] ==DR6 - Debug status== The debug status register permits the debugger to determine which debug conditions have occurred.[src] When the processor detects an enabled debug exception, it will set the corresponding bits of this register before entering the debug exception handler.[src] ==DR7 - Debug control== The debug control register is used to selectively enable the four address breakpoint conditions, and to specify the type and size of each of the four breakpoints.[src] There are two levels of enabling: the local (0,2,4,6) and global (1,3,5,7) levels.[src] The local enable bits are automatically reset by the processor at every task switch to avoid unwanted breakpoint conditions in the new task.[src] The global enable bits are not reset by a task switch; therefore, they can be used for conditions that are global to all tasks.[src] ==DR4 and DR5== Not real registers.[src] On processors that support the CR4.DE bit (Intel Pentium and later), their behaviour is controlled by CR4.DE: CR4.DE=0 : DR4 and DR5 alias to DR6 and DR7, respectively.[src] CR4.DE=1 : accessing DR4/5 results in #UD (invalid opcode) exception.[src] On processors without CR4.DE, the behaviour is officially undefined - usually, DR4/5 are aliased to DR6/7, but exceptions exist and have been used for CPU detection.[src] ==See also== Control register Test register ==References== Intel 80386 Programmer's Reference ==External links== http://www.codeproject.com/KB/debug/hardwarebreakpoint.aspx Using the debug registers in Windows.[src]
37 sentences · 37 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"X86 debug register." encyclopegia.org, 2026, https://encyclopegia.org/wiki/x86-debug-register. Accessed 29 November 2026.
Chicago
"X86 debug register." encyclopegia.org. Accessed November 29, 2026. https://encyclopegia.org/wiki/x86-debug-register.
APA
encyclopegia.org. (2026). X86 debug register. Retrieved November 29, 2026, from https://encyclopegia.org/wiki/x86-debug-register
Accessed November 29, 2026 · CC BY-SA 4.0 · citation page · JSON