Mick
Mick

Reputation: 7947

Dubugging a program not run within the debugger and without a crash

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?

Upvotes: 1

Views: 107

Answers (3)

SigTerm
SigTerm

Reputation: 26429

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 "Attach to process".

Professional edition of Visual Studio have Just-in-Time debugger, 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.

Upvotes: 2

ChrisF
ChrisF

Reputation: 137148

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.

Upvotes: 3

Didier Trosset
Didier Trosset

Reputation: 37467

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

Upvotes: 1

Related Questions