public DebugeeProcess(int processID, ICLRMetaHost iClrMetaHost, DebugEng eventDashboard) { Process debugee = Process.GetProcessById(processID); this.processID = (uint) processID; this.processName = debugee.ProcessName; this.iClrMetaHost = iClrMetaHost; ICLRRuntimeInfo iRuntime = FindRuntimeVersion(debugee.Handle); ICorDebug icorDebug = GetDebugger(iRuntime); icorDebug.Initialize(); callback = new ManagedCallback(eventDashboard); icorDebug.SetManagedHandler(callback); ICorDebugProcess iCorProcess = null; icorDebug.DebugActiveProcess((uint)processID, 0, out iCorProcess); isDebugMode = true; process = new TargetProcess(iCorProcess); }
protected override void CoreExecute(ref Result _result) { Process debugee = Process.GetProcessById((int)m_ProcessID); ICorDebug icorDebug = CLRHelperMethods.GetDebugger(debugee.Handle); icorDebug.Initialize(); MProcess mprocess = new MProcess(m_ProcessID); ManagedCallback callback = new ManagedCallback(mprocess.Listner); icorDebug.SetManagedHandler(callback); ICorDebugProcess iCorProcess = null; icorDebug.DebugActiveProcess(m_ProcessID, 0, out iCorProcess); if (iCorProcess != null) { mprocess.SetDebugProcess(iCorProcess); //mprocess.Continue(); _result.CommadStatus = true; _result.Description = "Process " + m_ProcessID + " Attached"; } //Just to complete the Attach process completetly . //This a need to be fixed. Thread.Sleep(2000); }