find no of times breakpoint is hit and break on nth hit

Hi,

My requirement is to break on a function when the breakpoint is hit nth time.
I used pseudo registers to find print the number when breakpoint is hit.

I wrote the following windbg command to do it

bp myfunction “.printf "functionhit eax = %08x count = %d",(ebp+0x0C),$t0;r @$t0 =@$t0 + 1;.echo;gc”

This works fine for me.
now my requirement is to break into the debugger when the breakpoint is hit nth time

How do I implement it?

Thanks,
Abhijit

bp Mymodule!MyFunction 32 “any command string”

will set a bp and skip breaking on it for the first 32 times and will
break on 33rd time if it is hit

On 5/14/13, xxxxx@gmail.com
wrote:
> Hi,
>
> My requirement is to break on a function when the breakpoint is hit nth
> time.
> I used pseudo registers to find print the number when breakpoint is hit.
>
> I wrote the following windbg command to do it
>
> bp myfunction “.printf "functionhit eax = %08x count =
> %d",(ebp+0x0C),$t0;r @$t0 =@$t0 + 1;.echo;gc”
>
> This works fine for me.
> now my requirement is to break into the debugger when the breakpoint is hit
> nth time
>
> How do I implement it?
>
> Thanks,
> Abhijit
>
>
> —
> WINDBG is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>