I learned this debugging trick from a colleague a few days ago
when we are debugging a bug together and I can’t wait to share
it. Conceptually it is really a simple idea but it is very
helpful.  Let’s say you are debugging a crash. You know the bug
is probably in function A but you have no idea how to stop at
the last time A is called before the crash (or whatever
debugging events that is interesting). WinDbg actually provides
a way to stop at a function when it is called N times, and then
the problem becomes how do you know what N is. Here is how:  1.
Start your app under debugger  2. Set a breakpoint with a big
hit count: for example, bp SomeDll!A 1000  3. Run your scenario
until the crash (or whatever debugging events that are
interesting to you)  4. See the breakpoint hit count using ‘bl’
command. It should show you the hit count left (say 900).  5.
Restart debugging. This time, set a breakpoint with hit count =
1000 – 900 (note that the numbers are typically in hex – time to
bring out calc.exe)  6. Run –