views:

101

answers:

2

Hey,

I have a program that crashes (seemingly) randomly after 2-4h of runtime. I am developing in c++ under Visual Studio Pro 2008. Since the crash occurs in an injected DLL (beeing injected into the memory space of a 3rd party software's memory space), I cannot use the Visual Studio Debugger, but I can get some output to the console using iter-process communication (I'm using a mailbox). So here is the question: What is the best way of debugging this? Is there a 3rd party software/add-on/debugger that can tell me what variable is NULL that causes the crash?

Thanks for your help.

+1  A: 

Try running the program under Windbg. When the crash occurs, you can probably get some specific info regarding the cause. You can startup the 3rd party process that hosts your dll and then attach the windbg debugger to the process. When the crash happens, windbg will likely halt and report some type of exception. You can then use the various windbg commands to look at thread stacks, etc.

Todd Stout
A: 

G'day,

Your question sets off two alarms for me.

* a memory leak smell which could be verified by running the same set of input and seeing if the crash happens at about the same elapsed time, and
* a specific test case that is tickling something in your third party library. You could do a binary chop on your input data to track down what's triggering this. I just had to do this to track down which request out of over two hundred thousand was triggering a memory leak in a custom Apache module. Divide and conquer. Divide and conquer. Divide and conquer. Repeat and rinse.

HTH

'Avahappy,

Rob Wells