1

I am writing a DLL using Visual C++ 2008, which is then loaded and runs inside another application (an exe written in Visual C++ that I do not have source code for). I nevertheless must debug my plugin's crashes that are occurring sometimes.

I have enabled JIT debugging in the Visual C++ 2008 debugger properties. I also have about 4 other versions of Visual Studio installed, for other projects, and I'm not sure if I also have to disable JIT for all other versions of Visual C++/Visual Studio that are installed.

Using JIT debug would be very handy here. However when the main program crashes I get this dialog:

   Title: "<Program name> has stopped working"
   Message: Windows is collecting more information about the problem.

Then I get the "Do you want to send more information about the problem?" dialog. It shows me that it created some files in c:\users\myuserid\AppData\Local\Temp\WER*.*

How do I modify the windows environment, or how do I create a valid manifest file that I could put external to the main crashing EXE to get it to enable JIT debug?

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • If the jit debugger is properly installed then you'll get a Debug button on the WER dialog. Maybe you didn't install it correctly. In general, the sane thing to do here is to just run the program with a debugger from the get-go. Keep in mind that it works for the release build as well, just not as easy to debug that one. – Hans Passant Jun 01 '13 at 17:28
  • I'm guessing it must not be. Do I have to reinstall visual Studio 2010 + SP1? – Warren P Jun 01 '13 at 19:09
  • You could spin that wheel of fortune. Best to find out what's wrong with your registry first, aedebug key in Ben's link. – Hans Passant Jun 01 '13 at 19:18

1 Answers1

1

Here is the MSDN documentation for JIT. Another strategy you can use is to load your dll project, run it with the host program as the command in the debug properties, and you'll already be in the debugger; yet another option is to attach to the process that is using your dll. Good luck, hope this helps :)

Ben Brammer
  • 988
  • 4
  • 11
  • Right now I am using attach to process, and using a MessageBox to halt things until I attach, which I think is gross, I hoped there was a better approach, and JIT seemed so good. – Warren P Jun 01 '13 at 19:10
  • MessageBox is modal, but won't necessarily stop processing in your dll; additionally, adding UI functionality to your dll is introducing unknowns that you may not be able to account for. Try using _asm {int 3} ( the DebugBreak() function is a nop in release code) to trigger a debugger interrupt. That should prompt you to debug. – Ben Brammer Jun 02 '13 at 17:21