本文整理汇总了C#中IDebugProcess2.GetPort方法的典型用法代码示例。如果您正苦于以下问题:C# IDebugProcess2.GetPort方法的具体用法?C# IDebugProcess2.GetPort怎么用?C# IDebugProcess2.GetPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDebugProcess2
的用法示例。
在下文中一共展示了IDebugProcess2.GetPort方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: catch
// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
{
Debug.Assert(_pollThread != null);
Debug.Assert(_engineCallback != null);
Debug.Assert(_debuggedProcess != null);
Debug.Assert(_ad7ProgramId == Guid.Empty);
try
{
AD_PROCESS_ID processId = EngineUtils.GetProcessId(process);
if (!EngineUtils.ProcIdEquals(processId, _debuggedProcess.Id))
{
return Constants.S_FALSE;
}
// Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach
// which will complete the hookup with AD7
IDebugPort2 port;
EngineUtils.RequireOk(process.GetPort(out port));
IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;
IDebugPortNotify2 portNotify;
EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));
EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(_debuggedProcess.Id)));
if (_ad7ProgramId == Guid.Empty)
{
Debug.Fail("Unexpected problem -- IDebugEngine2.Attach wasn't called");
return Constants.E_FAIL;
}
// NOTE: We wait for the program create event to be continued before we really resume the process
return Constants.S_OK;
}
catch (MIException e)
{
return e.HResult;
}
catch (Exception e) when (ExceptionHelper.BeforeCatch(e, Logger, reportOnlyCorrupting: true))
{
return EngineUtils.UnexpectedException(e);
}
}
示例2: Command
// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
{
IDebugPort2 port;
EngineUtils.RequireOk(process.GetPort(out port));
IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;
IDebugPortNotify2 portNotify;
EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));
EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode((int)pi.dwProcessId)));
if (this.m_ad7ProgramId == Guid.Empty)
{
Debug.Fail("Attaching failed");
return VSConstants.E_FAIL;
}
this._programCreateContinued.WaitOne();
this.writeCommandQueue.Enqueue(new Command(CommandKind.DebuggerEnvironmentReady));
NativeMethods.ResumeThread(threadHandle);
return 0;
}
示例3:
// This function is used to terminate a process that the SampleEngine launched
// The debugger will call IDebugEngineLaunch2::CanTerminateProcess before calling this method.
int IDebugEngineLaunch2.TerminateProcess(IDebugProcess2 process)
{
Log.Debug("Engine: TerminateProcess");
_events.ProgramDestroyed(_node);
IDebugPort2 port;
process.GetPort(out port);
var defaultPort = (IDebugDefaultPort2)port;
IDebugPortNotify2 notify;
defaultPort.GetPortNotify(out notify);
notify.RemoveProgramNode(_node);
Debugger.Stop();
return VSConstants.S_OK;
}
示例4: ResumeProcess
public int ResumeProcess(IDebugProcess2 pProcess)
{
DebugHelper.TraceEnteringMethod();
IDebugPort2 port;
pProcess.GetPort(out port);
Guid id;
pProcess.GetProcessId(out id);
var defaultPort = (IDebugDefaultPort2) port;
IDebugPortNotify2 notify;
defaultPort.GetPortNotify(out notify);
int result = notify.AddProgramNode(new AD7ProgramNode(DebuggedProcess, id));
return VSConstants.S_OK;
}
示例5: ResumeProcess
/// <summary>
/// Resumes process execution.
/// </summary>
/// <param name="pProcess">An IDebugProcess2 object that represents the process to be resumed.</param>
/// <returns>
/// If successful, returns S_OK; otherwise returns an error code.
/// </returns>
public override int ResumeProcess( IDebugProcess2 pProcess )
{
Logger.Debug( string.Empty );
var process = pProcess as PowerShellProcess;
if ( process == null )
{
return VSConstants.E_UNEXPECTED;
}
IDebugPort2 port;
pProcess.GetPort( out port );
var defaultPort = (IDebugDefaultPort2) port;
IDebugPortNotify2 portNotify;
defaultPort.GetPortNotify( out portNotify );
portNotify.AddProgramNode( Program );
return VSConstants.S_OK;
}
示例6: catch
/// <summary>
/// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended. (http://msdn.microsoft.com/en-us/library/bb146261.aspx)
/// </summary>
/// <param name="process"> An IDebugProcess2 object that represents the process to be resumed. </param>
/// <returns> An IDebugProcess2 object that represents the process to be resumed. </returns>
int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
{
Debug.Assert(m_engineCallback != null);
try
{
var xProcess = process as AD7Process;
if (xProcess == null)
{
return VSConstants.E_INVALIDARG;
}
// Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach
// which will complete the hookup with AD7
IDebugPort2 port = null;
EngineUtils.RequireOk(process.GetPort(out port));
IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;
IDebugPortNotify2 portNotify = null;
EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));
EngineUtils.RequireOk(portNotify.AddProgramNode(m_progNode));
Callback.OnModuleLoad(m_module);
Callback.OnThreadStart(currentThread());
}
catch (Exception e)
{
return EngineUtils.UnexpectedException(e);
}
return VSConstants.S_OK;
}
示例7: catch
// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
{
//Debug.Assert(Worker.MainThreadId == Worker.CurrentThreadId);
Debug.Assert(m_pollThread != null);
Debug.Assert(m_engineCallback != null);
Debug.Assert(m_debuggedProcess != null);
Debug.Assert(m_ad7ProgramId == Guid.Empty);
try {
var processId = EngineUtils.GetProcessId(process);
if (processId != m_debuggedProcess.Id) {
return Constants.S_FALSE;
}
// Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach
// which will complete the hookup with AD7
IDebugPort2 port;
EngineUtils.RequireOk(process.GetPort(out port));
var defaultPort = (IDebugDefaultPort2)port;
IDebugPortNotify2 portNotify;
EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));
EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(m_debuggedProcess.Id)));
if (m_ad7ProgramId == Guid.Empty) {
Debug.Fail("Unexpected problem -- IDebugEngine2.Attach wasn't called");
return Constants.E_FAIL;
}
// Resume the threads in the debuggee process
m_pollThread.RunOperation(() => m_debuggedProcess.ResumeFromLaunch());
return Constants.S_OK;
} catch (Exception e) {
return EngineUtils.UnexpectedException(e);
}
}
示例8: catch
// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
{
Debug.Assert(m_engineCallback != null);
try
{
var xProcess = process as AD7Process;
if (xProcess == null)
{
return VSConstants.E_INVALIDARG;
}
// Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach
// which will complete the hookup with AD7
IDebugPort2 port = null;
EngineUtils.RequireOk(process.GetPort(out port));
IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;
IDebugPortNotify2 portNotify = null;
EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));
//EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(m_debuggedProcess.Id))); //Copy AD7ProgramNode from Cosmos
EngineUtils.RequireOk(portNotify.AddProgramNode(m_progNode)); //Copy AD7ProgramNode from Cosmos
Callback.OnModuleLoad(m_module);
//Callback.OnSymbolSearch(m_module, xProcess.mISO.Replace("iso", "pdb"), enum_MODULE_INFO_FLAGS.MIF_SYMBOLS_LOADED); // from Cosmos
// Important!
//
// This call triggers setting of breakpoints that exist before run.
// So it must be called before we resume the process.
// If not called VS will call it after our 3 startup events, but thats too late.
// This line was commented out in earlier Cosmos builds and caused problems with
// breakpoints and timing.
Callback.OnThreadStart(currentThread());
m_process.ResumeFromLaunch();
}
catch (Exception e)
{
return EngineUtils.UnexpectedException(e);
}
return VSConstants.S_OK;
}
示例9:
int IDebugEngineLaunch2.TerminateProcess(IDebugProcess2 pProcess)
{
_node.Debugger.DoEndProgram();
Debug.WriteLine("AD7Engine TerminateProcess");
IDebugPort2 port;
pProcess.GetPort(out port);
var defaultPort = (IDebugDefaultPort2)port;
IDebugPortNotify2 notify;
defaultPort.GetPortNotify(out notify);
notify.RemoveProgramNode(_node);
return VSConstants.S_OK;
}