• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IDebugProcess2类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDebugProcess2的典型用法代码示例。如果您正苦于以下问题:C# IDebugProcess2类的具体用法?C# IDebugProcess2怎么用?C# IDebugProcess2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IDebugProcess2类属于命名空间,在下文中一共展示了IDebugProcess2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetProcess

        public int GetProcess(AD_PROCESS_ID ProcessId, out IDebugProcess2 ppProcess) {
            ppProcess = null;

            if (ProcessId.ProcessIdType != (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM) {
                return VSConstants.E_FAIL;
            }

            IEnumDebugProcesses2 processEnum;
            int hr = EnumProcesses(out processEnum);
            if (ErrorHandler.Failed(hr)) {
                return hr;
            }

            var processes = new IDebugProcess2[1];
            var pids = new AD_PROCESS_ID[1];
            uint fetched = 0;
            while (true) {
                hr = processEnum.Next(1, processes, ref fetched);
                if (ErrorHandler.Failed(hr)) {
                    return hr;
                } else if (fetched == 0) {
                    return VSConstants.E_FAIL;
                }

                if (ErrorHandler.Succeeded(processes[0].GetPhysicalProcessId(pids)) && ProcessId.dwProcessId == pids[0].dwProcessId) {
                    ppProcess = processes[0];
                    return VSConstants.S_OK;
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:30,代码来源:NodeRemoteDebugPort.cs


示例2: Event

        public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program, 
			IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
        {
            if (!(debugEvent is IDebugProcessCreateEvent2) &&
                !(debugEvent is IDebugProcessDestroyEvent2))
                return VSConstants.S_OK;

            var target = GetTargetFromProcess(process);
            if (target == null)
            {
                _package.Reporter.ReportWarning("Can't find target from process {0} ({1}). Event: {2}.",
                    process.GetName(), process.GetProcessId(), TypeHelper.GetDebugEventTypeName(debugEvent));
                return VSConstants.S_OK;
            }

            if (debugEvent is IDebugProcessCreateEvent2)
            {
                target.IsAttached = true;
                _package.History.Items.AddFirst(target);
                _package.Ui.Update();
            }
            else
            {
                target.IsAttached = false;
                _package.Ui.Update();
            }

            return VSConstants.S_OK;
        }
开发者ID:ticoaraujo,项目名称:ReAttach,代码行数:29,代码来源:ReAttachDebugger.cs


示例3: Event

        public static int Event(this IDebugEventCallback2 callback, IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program, IDebugThread2 thread, DebugEvent debugEvent)
        {
            Contract.Requires<ArgumentNullException>(callback != null, "callback");
            Contract.Requires<ArgumentNullException>(debugEvent != null, "debugEvent");
            Contract.Requires<ArgumentNullException>(engine != null, "engine");

            return callback.Event(engine, process, program, thread, debugEvent, debugEvent.EventGuid, (uint)debugEvent.Attributes);
        }
开发者ID:fjnogueira,项目名称:JavaForVS,代码行数:8,代码来源:DebugEventCallbackExtensions.cs


示例4: Send

 /// <summary>
 /// Perform actual send
 /// </summary>
 private void Send(IDebugProcess2 process, IDebugProgram2 program, IDebugThread2 thread, BaseEvent @event)
 {
     var guid = @event.IID;
     DLog.Debug(DContext.VSDebuggerEvent, "DebugEngine Event {0} {1}", @event.GetType().Name, guid);
     var rc = callback.Event(engine, process, program, thread, @event, ref guid, (uint)@event.Attributes);
     if (!ErrorHandler.Succeeded(rc))
     {
         DLog.Error(DContext.VSDebuggerEvent, "DebugEngine Event failed {0}", rc);
     }
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:13,代码来源:EngineEventCallback.cs


示例5: GetProcess

            public int GetProcess(AD_PROCESS_ID ProcessId, out IDebugProcess2 ppProcess) {
                ppProcess = null;

                if (ProcessId.ProcessIdType != (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM) {
                    return VSConstants.E_FAIL;
                }

                ppProcess = GetProcesses().FirstOrDefault(p => p.ProcessId == ProcessId.dwProcessId);
                return ppProcess != null ? VSConstants.S_OK : VSConstants.E_FAIL;
            }
开发者ID:Microsoft,项目名称:RTVS,代码行数:10,代码来源:RDebugPortSupplier.DebugPort.cs


示例6: GetProcessId

        public static int GetProcessId(IDebugProcess2 process) {
            AD_PROCESS_ID[] pid = new AD_PROCESS_ID[1];
            EngineUtils.RequireOk(process.GetPhysicalProcessId(pid));

            if (pid[0].ProcessIdType != (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM) {
                return 0;
            }

            return (int)pid[0].dwProcessId;
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:10,代码来源:EngineUtils.cs


示例7: Event

        public int Event(IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
        {
            if (pEvent is IRunspaceRequest)
            {
                var request = pEvent as IRunspaceRequest;
                request.SetRunspace(_runspace, _breakpoints);
            }

            return VSConstants.S_OK;
        }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:10,代码来源:DebugEventManager.cs


示例8: Event

        public int Event( IDebugEngine2 pEngine,
            IDebugProcess2 pProcess,
            IDebugProgram2 pProgram,
            IDebugThread2 pThread,
            IDebugEvent2 pEvent,
            ref Guid riidEvent,
            uint dwAttrib)
        {
            Logger.Debug( string.Empty );

            return VSConstants.S_OK;
        }
开发者ID:IntelliTect,项目名称:PowerStudio,代码行数:12,代码来源:PowerShellDebuggerEvents.cs


示例9: Event

        public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program,
            IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
        {
            if (process == null)
                return VSConstants.S_OK;
            string processName;
            if (process.GetName((uint) enum_GETNAME_TYPE.GN_FILENAME, out processName) != VSConstants.S_OK)
                return VSConstants.S_OK;
            if (processName.EndsWith("vshost.exe"))
                return VSConstants.S_OK;

            var shortName = Path.GetFileName(processName);

            if (debugEvent is IDebugProcessCreateEvent2)
            {
                Log.Instance.SetStatus("[attaching...] {0}", shortName);
                Storage.Instance.SubscribeProcess(processName);
            }
            if (debugEvent is IDebugProcessDestroyEvent2)
            {
                Log.Instance.SetStatus("[detached] {0}", shortName);
                Log.Instance.AppendLine("[detached] {0}", shortName);
            }
            if (debugEvent is  IDebugLoadCompleteEvent2)
            {
                if (program != null)
                {
                    string engineName;
                    Guid engineId;
                    if (program.GetEngineInfo(out engineName, out engineId) == VSConstants.S_OK)
                    {
                        var fields = new PROCESS_INFO[1];
                        if (process.GetInfo((uint)enum_PROCESS_INFO_FIELDS.PIF_PROCESS_ID, fields) != VSConstants.S_OK)
                            return VSConstants.S_OK;
                        Storage.Instance.SubscribeEngine(processName, engineId);
                        AttachCenter.Instance.Freeze();

                        Log.Instance.SetStatus("[attached] {0}", shortName);
                        Log.Instance.AppendLine("[attached] {0} ({1}) / {2}", shortName, fields[0].ProcessId.dwProcessId, engineName);
                    }
                }
            }
            return VSConstants.S_OK;
        }
开发者ID:modulexcite,项目名称:Resurrect,代码行数:44,代码来源:DebugEventsHunter.cs


示例10: Event

        public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program,
            IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
        {
            // Ignore a few events right away.
            if (debugEvent is IDebugModuleLoadEvent2 ||
                debugEvent is IDebugThreadCreateEvent2 ||
                debugEvent is IDebugThreadDestroyEvent2)
                return VSConstants.S_OK;

            if (process == null)
                return VSConstants.S_OK;

            if (debugEvent is IDebugProcessCreateEvent2) {
                State.IsAttached = true;
            }
            else if (debugEvent is IDebugProcessDestroyEvent2) {
                State.IsAttached = false;
            }

            return VSConstants.S_OK;
        }
开发者ID:modulexcite,项目名称:AttachToolbar,代码行数:21,代码来源:AttachToolbarController.cs


示例11: Event

        public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program, 
			IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
        {
            // Ignore a few events right away.
            if (debugEvent is IDebugModuleLoadEvent2 ||
                debugEvent is IDebugThreadCreateEvent2 ||
                debugEvent is IDebugThreadDestroyEvent2)
                return VSConstants.S_OK;

            // Trace.WriteLine(TypeHelper.GetDebugEventTypeName(debugEvent)); // TODO: Remove me.

            if (process == null)
                return VSConstants.S_OK;

            var target = GetTargetFromProcess(process);

            if (target == null)
            {
                _package.Reporter.ReportWarning("Can't find target from process {0} ({1}). Event: {2}.",
                    process.GetName(), process.GetProcessId(), TypeHelper.GetDebugEventTypeName(debugEvent));
                return VSConstants.S_OK;
            }
            if (debugEvent is IDebugProcessCreateEvent2)
            {
                target.IsAttached = true;
                _package.History.Items.AddFirst(target);
                _package.Ui.Update();
                return VSConstants.S_OK;
            }

            if (debugEvent is IDebugProcessDestroyEvent2)
            {
                target.IsAttached = false;
                _package.Ui.Update();
                return VSConstants.S_OK;
            }

            return VSConstants.S_OK;
        }
开发者ID:jijamw,项目名称:ReAttach,代码行数:39,代码来源:ReAttachDebugger.cs


示例12: Event

        public int Event(IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
        {
            if (riidEvent == typeof(IDebugOutputStringEvent2).GUID)
            {
                IDebugOutputStringEvent2 ev = pEvent as IDebugOutputStringEvent2;
                if (ev != null)
                {
                    string message;
                    if (ErrorHandler.Succeeded(ev.GetString(out message)))
                    {
                        var lines = message.Split(sp, StringSplitOptions.RemoveEmptyEntries);

                        foreach(var line in lines)
                        {
                            HandleMessage(line);
                        }
                    }
                }
            }

            return VSConstants.S_OK;
        }
开发者ID:rugbbyli,项目名称:VSLogcat,代码行数:22,代码来源:IDebugOutputStringEvent2.cs


示例13: Event

        public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program, 
			IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
        {
            // _package.Reporter.ReportTrace(TypeHelper.GetDebugEventTypeName(debugEvent));

            if (!(debugEvent is IDebugProcessCreateEvent2) &&
                !(debugEvent is IDebugProcessDestroyEvent2))
                return VSConstants.S_OK;

            var target = GetTargetFromProcess(process);
            if (target == null)
            {
                _package.Reporter.ReportWarning("Can't find target from process {0} ({1}). Event: {2}.",
                    process.GetName(), process.GetProcessId(), TypeHelper.GetDebugEventTypeName(debugEvent));
                return VSConstants.S_OK;
            }

            if (debugEvent is IDebugProcessCreateEvent2)
            {
                var engines = target.Engines.Where(e => _engines.ContainsKey(e)).Select(e => _engines[e]).ToArray();

                var mode = new DBGMODE[1];
                _debugger.GetMode(mode);
                if (mode[0] == DBGMODE.DBGMODE_Design)
                    return VSConstants.S_OK;

                target.IsAttached = true;
                _package.History.Items.AddFirst(target);
                _package.Ui.Update();
            }
            else
            {
                target.IsAttached = false;
                _package.Ui.Update();
            }

            return VSConstants.S_OK;
        }
开发者ID:erlandranvinge,项目名称:ReAttach,代码行数:38,代码来源:ReAttachDebugger.cs


示例14: Event

        public int Event(IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib) {
            if (riidEvent == typeof(IDebugProgramCreateEvent2).GUID) {
                Guid processId;

                // A program was created and attached
                if (pProcess != null) {
                    if (VSConstants.S_OK == pProcess.GetProcessId(out processId)) {
                        DkmProcess dkmProcess = DkmProcess.FindProcess(processId);

                        if (dkmProcess != null) {
                            var debugTrigger = DkmExceptionCodeTrigger.Create(DkmExceptionProcessingStage.Thrown, null, DkmExceptionCategory.Win32, RemoteDebugStartExceptionCode);
                            var attachTrigger = DkmExceptionCodeTrigger.Create(DkmExceptionProcessingStage.Thrown, null, DkmExceptionCategory.Win32, RemoteDebugAttachExceptionCode);

                            // Try to add exception trigger for when a remote debugger server is started for Python
                            dkmProcess.AddExceptionTrigger(RemoteDebugExceptionGuid, debugTrigger);
                            dkmProcess.AddExceptionTrigger(RemoteDebugExceptionGuid, attachTrigger);
                        }
                    }
                }
            }

            return VSConstants.S_OK;
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:23,代码来源:PythonRemoteDebugEvents.cs


示例15: GetProcess

        public int GetProcess(out IDebugProcess2 process)
        {
            Debug.Fail("This function is not called by the debugger");

            process = null;
            return Constants.E_NOTIMPL;
        }
开发者ID:wesrupert,项目名称:MIEngine,代码行数:7,代码来源:AD7Engine.cs


示例16: JavaDebugProgram

        public JavaDebugProgram(IDebugProcess2 process)
        {
            Contract.Requires<ArgumentNullException>(process != null, "process");

            _process = process;
        }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:6,代码来源:JavaDebugProgram.cs


示例17: GetProcess

 public int GetProcess(out IDebugProcess2 ppProcess)
 {
     ppProcess = _process;
     return VSConstants.S_OK;
 }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:5,代码来源:JavaDebugProgram.cs


示例18: LaunchSuspended

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int 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)
    {
      // 
      // Normally, VS launches a program using the IDebugPortEx2::LaunchSuspended method, and the attaches the debugger to the suspended program.
      // However, there are circumstances in which the DebugEngine may need to launch a program or other dependencies (e.g. tools or interpreters) in which case this method is used.
      // IDebugEngineLaunch2::ResumeProcess method is called to start the process after the program has been launched in a suspended state.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        if (port == null)
        {
          throw new ArgumentNullException ("port");
        }

        if (string.IsNullOrEmpty (exe))
        {
          throw new ArgumentNullException ("exe");
        }

        if (!File.Exists (exe))
        {
          throw new FileNotFoundException ("Failed to find target application: " + exe);
        }

        m_sdmCallback = new DebugEngineCallback (this, ad7Callback);

        DebuggeePort debuggeePort = port as DebuggeePort;

        DebuggeeProcess debugProcess = null;

        // 
        // Evaluate options; including current debugger target application.
        // 

        if (m_launchConfiguration == null)
        {
          throw new InvalidOperationException ("No launch configuration found.");
        }

        m_launchConfiguration.FromString (options);

        string packageName = m_launchConfiguration ["PackageName"];

        string launchActivity = m_launchConfiguration ["LaunchActivity"];

        bool debugMode = m_launchConfiguration ["DebugMode"].Equals ("true");

        bool openGlTrace = m_launchConfiguration ["OpenGlTrace"].Equals ("true");

        bool appIsRunning = false;

        // 
        // Cache any LaunchSuspended specific parameters.
        // 

        m_launchConfiguration ["LaunchSuspendedExe"] = exe;

        m_launchConfiguration ["LaunchSuspendedDir"] = dir;

        m_launchConfiguration ["LaunchSuspendedEnv"] = env;

        // 
        // Prevent blocking the main VS thread when launching a suspended application.
        // 

        Broadcast (new DebugEngineEvent.DebuggerConnectionEvent (DebugEngineEvent.DebuggerConnectionEvent.EventType.ShowDialog, string.Empty), null, null);

        ManualResetEvent launchSuspendedMutex = new ManualResetEvent (false);

        Thread asyncLaunchSuspendedThread = new Thread (delegate ()
        {
          try
          {
            // 
            // Launch application on device in a 'suspended' state.
            // 

            Broadcast (new DebugEngineEvent.DebuggerConnectionEvent (DebugEngineEvent.DebuggerConnectionEvent.EventType.LogStatus, string.Format ("Starting '{0}'...", packageName)), null, null);

            if (!appIsRunning)
            {
              StringBuilder launchArgumentsBuilder = new StringBuilder ();

              launchArgumentsBuilder.Append ("start ");

              if (debugMode)
              {
                launchArgumentsBuilder.Append ("-D "); // debug
              }
              else
              {
                launchArgumentsBuilder.Append ("-W "); // wait
              }
//.........这里部分代码省略.........
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:101,代码来源:DebugEngine.cs


示例19: CanTerminateProcess

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #endregion

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #region IDebugEngineLaunch2 Members

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int CanTerminateProcess (IDebugProcess2 process)
    {
      // 
      // Determines if a process can be terminated.
      // 

      LoggingUtils.PrintFunction ();

      return Constants.S_OK;
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:26,代码来源:DebugEngine.cs


示例20: TerminateProcess

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int TerminateProcess (IDebugProcess2 process)
    {
      // 
      // Terminate a process launched by IDebugEngineLaunch2.LaunchSuspended.
      // 
      // The debugger will call IDebugEngineLaunch2.CanTerminateProcess before calling this method.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        DebuggeeProcess debugProcess = (process as DebuggeeProcess);

        LoggingUtils.RequireOk (debugProcess.Terminate ());

        Detach (debugProcess.DebuggeeProgram);

        return Constants.S_OK;
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        return Constants.E_FAIL;
      }
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:31,代码来源:DebugEngine.cs



注:本文中的IDebugProcess2类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDebugProgram2类代码示例发布时间:2022-05-24
下一篇:
C# IDebugMemoryContext2类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap