views:

13

answers:

2

I am getting difficulty debugging my custom IIS module written in C++, using VS 2010. The problem is that IIS worker process (w3wp.exe) starts too quickly and there is no way to catch it at the beginning in VS "attach to process" dialog. Is there a good skill to do this? Thanks.

A: 

A trick that I have sometimes used is to introduce an artificial infinite loop at the entry point of my code, I then set a breakpoint in this loop and simply move the next instruction to be out of the loop when the breakpoint is hit - job done!

Kragen
+1  A: 

You can add a Debugger Breakpoint in your code . I use this all the time to catch things that are too fast to catch manually.

FYi in .net you use System.Diagnostics.Debugger.Break() to achieve the same effect.

It causes the windows system debugger to be activated.

Preet Sangha
Fantastic! This is ideal trick I am looking for, and works for me. Many thanks.
Sheen
Remember to remove it from the production code.
Preet Sangha