Re: Evolution

From: Herbert Kleebauer (klee_at_unibwm.de)
Date: 11/20/03


Date: Thu, 20 Nov 2003 11:15:04 +0100

Randall Hyde wrote:

Many words, opinions but no facts (reminds me on Beth), so
nothing to answer. Just two remarks:

> Also, a construct like "**p=++i;" often gets
> replaced by something else when the programmer sees the number of
> instructions this code explodes into.

Using a 15 year old DOS C compiler (Turbo C 2.01)
without any optimization I get for "main(){**p=++i;}"

_main proc near
        inc word ptr DGROUP:_i
        mov ax,word ptr DGROUP:_i
        mov bx,word ptr DGROUP:_p
        mov bx,word ptr [bx]
        mov word ptr [bx],ax
@1:
        ret
_main endp

What's wrong with this code?

> > (it is great if you can
> > use hardware breakpoints by using the processor debug registers
> > in your debugger).
>
> ????
> Hardware breakpoints are available in debuggers under Windows

Then please tell me how (without modifying the task switch
routine in Windows or running the debugger with CPL=0).

>From MSDN:

Since the four debug registers are global to the system, they
should typically only be touched by a kernel mode debugger. See
Knowledge Base Article Q137199, " PRB: Debuggers Cannot
Use Debug Register Breakpoints" for more information.

See also the following MSDN Library CD article: Q105275,
"Using the 'BR' Command in WDEB386.EXE".



Relevant Pages

  • Re: GetThreadContext and debug register problem
    ... A decent app should not care about debugger. ... debugger could go into debug mode is setting debug registers and ... originally used the kernel debug to trigger the debug registers as I ... CONTEXT structure, and then pass it to SetThreadContext. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Why do Intels processors provide four debug registers rather than only one?
    ... another good debugger. ... there are four debug registers inside ... we can do this job in the service routine of the debug interrupt. ... assuming we want to set two breakpoints at address 5 and 7. ...
    (microsoft.public.development.device.drivers)
  • Re: Evolution
    ... > Hardware breakpoints are available in debuggers under Windows ... I said "use hardware breakpoints in your debugger" and not "use ... can use hardware breakpoints (I can use the debug registers only ...
    (alt.lang.asm)