views:

68

answers:

3

I left a program running last night, it worked fine for about 5 hours and then one of its built-in self-diagnostic tests detected a problem and brought up a dialog box telling me the issue. The program was built with debug information (/Zi). Is it possible to somehow get the debugger started so I can examine the value of some variables within the program? Or is it too late?

+1  A: 

There is an option in the Debug menu to attach the debugger to a running process, IIRC.

Didier Trosset
Yep, fire up VS and go to Debug -> Attach to process
Paolo
+3  A: 

You can attach the debugger to the running process:

Debug > Attach to Process...

Just open up the program's solution first.

Assuming you've still got the error dialog on the screen you can break into the program and work back up the call stack examining variables etc.

ChrisF
+2  A: 

For the future crashes ... if you have windbg or visual studio professional, you can debug crash dumps, even when program isn't running. It is quite useful sometimes. See "MiniDumpWriteDump" on msdn for more info.

Other than that it is "Attack to process".

Professional edition of visual studio have Just-in-Time debugerr, that will kick in as soon as anything crashes, even if MSVC wasn't running. It will also locate source code (if debug info and source code are available) and open/create solution for you.

SigTerm