Re: Why do Intel's processors provide four debug registers rather than only one?




Lighter wrote:
Why do Intel's processors provide four debug registers rather than only
one?

As we know, there are four debug registers (DR0 through DR3) inside
every Intel's processor except for the very early ones. What makes me
confused is as follows:

To my thinking, one debug regiter is enough to set a breakpoint for a
runnning program. If we need to set more breakpoints for this program,
we can do this job in the service routine of the debug interrupt. For
example, assuming we want to set two breakpoints at address 5 and 7. To
this end, we can first set DR0 to addess 5, when the program attempts
to executes the instruction at address 5, a debug interrupt will be
triggered and the ISR we provided in advance will be called. In the
ISR, we can set D0 to address 7 and return. Thus, the program will be
interrupted again when it attempts to execute the instruction at
address 7.

Following the steps I describe above seems a good solution to debugging
all kinds of programs. Why does the processor provide four ones? I
cannot think out how much we can benefit from providing more than one
debug register.


What makes you think that the program will execute the instruction at 5
before the instruction at 7 (ignoring the fact the locations "5" and
"7" are unrealistically close together)? Or that it won't execute the
instruction at one location several times before hitting the
instruction at the other location?

In addition, the breakpoints registers can be use to trap different
types of events. For example, a breakpoint register can be set to trap
when data is written to a location, or if an instruction is executed at
that location.

.



Relevant Pages

  • Re: Is there a open souce IDE writen by C( C++) or partly writen by C( C++)?
    ... Of course, python scripts debugger ... you've got to open the debug dialog. ... Step means your program would execute the next ... instruction, Over means your program would execute until the next ...
    (comp.lang.python)
  • Re: debug registers
    ... > monitor another program for a certain instruction to execute? ... > a LIDT instruction: I can do that without the debug regs easily ...
    (comp.lang.asm.x86)
  • debug registers
    ... Can the debug registers be used to ... monitor another program for a certain instruction to execute? ... a LIDT instruction: I can do that without the debug regs easily ...
    (comp.lang.asm.x86)
  • Re: wchar_t as a string parameter
    ... I have pasted the disassembly (for both DEBUG and RELEASE builds) for your ... Record the value that is in esp at this point. ... Set a breakpoint at this instruction. ... As far as stepping through the assembly code and examining the stack...I ...
    (microsoft.public.vc.mfc)
  • Re: 8086 Assembly Programming Help
    ... > I am using DEBUG through MS-DOS to make and run a certain program. ... > I know how to do the basic things like MOV, ADD, SUB but when it comes ... subcommand for code and a subcommand + db subsubcommand for data, ... and points to the first instruction ...
    (comp.lang.asm.x86)