How do I attach a specific debugger engine to a process I launch?

Hmmm! Looks like someone is feeling lonely. No seriously, this is an area where the doctor does not have very many recommendations. Visual Studio 2003 Debugger object model does not expose any way to specify a specific debug engine to be used when attaching to or launching a process under the debugger. This might change in future releases of Visual Studio.

If you are a Visual Studio Package then you can specify the debug engine to use when debugging a process. Here is what you need to do:

· Query for the SVsDebugger service and get the IVsDebugger interface

· Allocate and initialize a VsDebugTargetInfo structure with appropriate values

· Set the VsDebugTargetInfo.clsidCustom member to choose the debug engine of choice.

· You can view debug engine GUIDs from EnvSDK\common\inc\msdbg.h. See code snippet below

· Call IVsDebugger::LaunchDebugTargets passing the VsDebugTargetInfo structure created above

 

//from msdbg.h

extern GUID guidScriptEng;

extern GUID guidSQLEng;

extern GUID guidCOMPlusNativeEng;

extern GUID guidCOMPlusOnlyEng;

extern GUID guidNativeOnlyEng;

extern GUID guidMsOrclEng;

extern GUID guidEmbeddedCLREng;

See the FigPkgs\FigPrj sample for more information.

Thanks

Dr. eX