Hello,
I am writing a custom Debug Engine to debug on a remote device in VS2010 Ultimate on Windows 7.
I have a class which implements the IDebugEngine2 and IDebugEngineLaunch2 interfaces. I am able to step through LaunchSuspended which is called after calling LaunchDebugTargets in a Launcher which displays a window to select what to debug.
In LaunchSuspended I create an instance of a class which implements the IDebugProcess2 interface. My Launch Suspended looks like follows:
int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, string exe, string args, string dir, string env, string options, enum_LAUNCH_FLAGS launchFlags, uint hStdInput, uint hStdOutput, uint hStdError, IDebugEventCallback2 ad7Callback, out IDebugProcess2 process) { process = null; if (!File.Exists(exe)) { return 0; } m_package = exe; m_workingDir = dir; if (launchFlags.HasFlag(enum_LAUNCH_FLAGS.LAUNCH_DEBUG)) { process = new DebugProcess(port, exe, dir, true); } else { process = new DebugProcess(port, exe, dir, false); } m_debuggedProcess = (process as DebugProcess); return VSConstants.S_OK; }
I then see that GetPhysicalProcessId, then GetProcessId are called on the DebugProcess followed by Terminate. The call stack when Terminate is called is the following:
> Debugger.dll!Debugger.Engine.DebugProcess.Microsoft.VisualStudio.Debugger.Interop.IDebugProcess2.Terminate() Line 75 C# [Native to Managed Transition] [Managed to Native Transition] Microsoft.VisualStudio.TraceLogPackage.dll!Microsoft.VisualStudio.TraceLogPackage.DebugLaunchHook._OnLaunchDebugTargets(uint debugTargetCount, Microsoft.VisualStudio.Shell.Interop.VsDebugTargetInfo3[] debugTargets, Microsoft.VisualStudio.Shell.Interop.VsDebugTargetProcessInfo[] launchResults = {Microsoft.VisualStudio.Shell.Interop.VsDebugTargetProcessInfo[1]}) + 0x3b8 bytes Microsoft.VisualStudio.TraceLogPackage.dll!Microsoft.VisualStudio.TraceLogPackage.DebugLaunchHook.OnLaunchDebugTargets.AnonymousMethod__7() + 0x14 bytes Microsoft.VisualStudio.IntelliTrace.dll!Microsoft.VisualStudio.Diagnostics.Common.ILExceptionFilter.Invoke(Microsoft.VisualStudio.Diagnostics.Common.ILExceptionFilter.InvocationTarget target, Microsoft.VisualStudio.Diagnostics.Common.ILExceptionFilter.FilterFunction predicate = {Method = {System.Reflection.RuntimeMethodInfo}}, Microsoft.VisualStudio.Diagnostics.Common.ILExceptionFilter.HandlerFunction catchBlock = {Method = {System.Reflection.RuntimeMethodInfo}}) + 0x29 bytes Microsoft.VisualStudio.IntelliTrace.dll!Microsoft.VisualStudio.Diagnostics.Common.ExceptionHelper.Invoke(Microsoft.VisualStudio.Diagnostics.Common.ILExceptionFilter.InvocationTarget target) + 0x82 bytes [Native to Managed Transition] [Managed to Native Transition] Launcher.dll!Launcher.Connect.LaunchDebugTarget(string filePath = "[bundle to run]", string workingDir = "[dir]") Line 180 + 0x14 bytes C#
I have verified that all members of the interfaces are implemented in the 2 classes. What am I missing? Do I need to create a custom PortSupplier since I am not launching a local process to debug?
After continuing from Terminate a message box is displayed with the text "Cannot detach from one or more processes: [N/A]: The object Invoked has disconnected from it's clients.