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;
        }
        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);
        }
        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;
        }
        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;
        }
        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;
        }
        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;
        }
Exemple #7
0
        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;
        }
        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;
        }
        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;
        }
        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;
        }
Exemple #11
0
 private AD7EngineCreateEvent(AD7Engine engine)
 {
     _engine = engine;
 }
 int IDebugEventCallback2.Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program, IDebugThread2 thread, IDebugEvent2 @event, ref Guid riidEvent, uint attribs)
 {
     IDebugEventCallback2 ad7EventCallback = GetAD7EventCallback();
     return ad7EventCallback.Event(engine, process, program, thread, @event, ref riidEvent, attribs);
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int Event (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      // 
      // Custom event handler.
      // 

      try
      {
        LoggingUtils.Print ("[CLangDebuggerCallback] Event: " + riidEvent.ToString ());

        CLangDebuggerEventDelegate eventCallback;

        if (!m_debuggerCallback.TryGetValue (riidEvent, out eventCallback))
        {
          return Constants.E_NOTIMPL;
        }

        return eventCallback (m_debugEngine.NativeDebugger);
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        throw;
      }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int OnProgramCreate (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      LoggingUtils.PrintFunction ();

      try
      {
        /*DebuggeeProgram p = pProgram as DebuggeeProgram;

        bool worked = false;

        if (pProgram is DebuggeeProgram)
        {
          worked = true;
        }

        Type t = pProgram.GetType ();

        IntPtr pUnk = Marshal.GetIUnknownForObject (pProgram);

        Guid guidDebuggeeProgram = ComUtils.GuidOf (typeof (IDebugProgram2));

        IDebugProgram2 debuggeeProgramObj = (IDebugProgram2) Marshal.GetTypedObjectForIUnknown (pUnk, typeof (IDebugProgram2));

        DebuggeeProgram debuggeeProgram = debuggeeProgramObj as DebuggeeProgram;

        debuggeeProgram = (DebuggeeProgram) Marshal.CreateWrapperOfType (debuggeeProgramObj, typeof (IDebugProgram2));
        */

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

        return VSConstants.E_FAIL;
      }
    }
        // TODO: Evaluate if this is still necessary
        //private void WarnAboutPGO(string moduleName) {
        //    const string content =
        //        "Python/native mixed-mode debugging does not support Python interpreters that are built with PGO (profile-guided optimization) enabled. " +
        //        "If you are using a stock Python interpreter, you should upgrade to a more recent version of it. If you're using a custom built " +
        //        "interpreter, please disable PGO.";
        //    MessageBox.Show(content, "PGO Is Not Supported", MessageBoxButton.OK, MessageBoxImage.Error);
        //}

        private void SetDebugOptions(IDebugEngine2 engine) {
            var pyService = _serviceProvider.GetPythonToolsService();

            var options = new StringBuilder();
            if (pyService.DebuggerOptions.WaitOnAbnormalExit) {
                options.Append(";" + AD7Engine.WaitOnAbnormalExitSetting + "=True");
            }
            if (pyService.DebuggerOptions.WaitOnNormalExit) {
                options.Append(";" + AD7Engine.WaitOnNormalExitSetting + "=True");
            }
            if (pyService.DebuggerOptions.TeeStandardOutput) {
                options.Append(";" + AD7Engine.RedirectOutputSetting + "=True");
            }
            if (pyService.DebuggerOptions.BreakOnSystemExitZero) {
                options.Append(";" + AD7Engine.BreakSystemExitZero + "=True");
            }
            if (pyService.DebuggerOptions.DebugStdLib) {
                options.Append(";" + AD7Engine.DebugStdLib + "=True");
            }

            engine.SetMetric(AD7Engine.DebugOptionsMetric, options.ToString());
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int OnDebuggerLogcatEvent (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      LoggingUtils.PrintFunction ();

      try
      {
        DebugEngineEvent.DebuggerLogcatEvent debuggerLogcatEvent = pEvent as DebugEngineEvent.DebuggerLogcatEvent;

        using (SyncRedirectProcess command = AndroidAdb.AdbCommand (debuggerLogcatEvent.HostDevice, "logcat", "-c"))
        {
          command.StartAndWaitForExit ();
        }

        m_adbLogcatProcess = AndroidAdb.AdbCommandAsync (debuggerLogcatEvent.HostDevice, "logcat", "");

        m_adbLogcatListener = new DeviceLogcatListener ();

        if (m_adbLogcatProcess == null)
        {
          throw new InvalidOperationException ("Failed to launch logcat application.");
        }

        if (m_adbLogcatListener == null)
        {
          throw new InvalidOperationException ("Failed to launch logcat listener.");
        }

        m_adbLogcatProcess.Start (m_adbLogcatListener);

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

        return VSConstants.E_FAIL;
      }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int OnError (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      LoggingUtils.PrintFunction ();

      try
      {
        DebugEngineEvent.Error errorEvent = pEvent as DebugEngineEvent.Error;

        enum_MESSAGETYPE [] messageType = new enum_MESSAGETYPE [1];

        string errorFormat, errorHelpFileName;

        int errorReason;

        uint errorType, errorHelpId;

        LoggingUtils.RequireOk (errorEvent.GetErrorMessage (messageType, out errorFormat, out errorReason, out errorType, out errorHelpFileName, out errorHelpId));

        LoggingUtils.RequireOk (m_debuggerConnectionService.LaunchDialogUpdate (errorFormat, true));

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

        return VSConstants.E_FAIL;
      }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #endregion

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

    #region IDebugEventCallback2 Members

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

    public int Event (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      try
      {
        DebuggerEventListenerDelegate callback;

        LoggingUtils.Print ("[DebuggerEventListener] Event: " + riidEvent.ToString ());

        int handle = VsDebugCommon.Constants.E_NOTIMPL;

        if (!m_eventCallbacks.TryGetValue (riidEvent, out callback))
        {
          return handle;
        }

        handle = callback (pEngine, pProcess, pProgram, pThread, pEvent, ref riidEvent, dwAttrib);

        if (handle != VsDebugCommon.Constants.E_NOTIMPL)
        {
          LoggingUtils.RequireOk (handle);
        }

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

        return VSConstants.E_FAIL;
      }
    }
Exemple #19
0
        int IDebugEngineCreateEvent2.GetEngine(out IDebugEngine2 engine)
        {
            engine = m_engine;

            return VSConstants.S_OK;
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int OnThreadDestroy (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      LoggingUtils.PrintFunction ();

      return Constants.E_NOTIMPL;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int OnError (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      // 
      // IDebugErrorEvent2 is used to report error messages to the user when something goes wrong in the debug engine.
      // 

      LoggingUtils.PrintFunction ();

      return Constants.E_NOTIMPL;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #region DebugEngineCallbackInterface Members

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

    public int Event (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      LoggingUtils.Print ("[DebugEngineCallback] Event: " + riidEvent.ToString ());

      // 
      // Process any registered function handler before passing the event to AD7 callback.
      // 

      int handle = Constants.E_NOTIMPL;

      try
      {
        DebuggerEventDelegate eventCallback;

        if (m_debuggerCallback.TryGetValue (riidEvent, out eventCallback))
        {
          handle = eventCallback (pEngine, pProcess, pProgram, pThread, pEvent, ref riidEvent, dwAttrib);
        }

        if (handle != Constants.E_NOTIMPL)
        {
          LoggingUtils.RequireOk (handle);
        }
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        throw;
      }
      finally
      {
        try
        {
          handle = m_ad7EventCallback.Event (pEngine, pProcess, pProgram, pThread, pEvent, ref riidEvent, dwAttrib);

          if (handle != Constants.E_NOTIMPL)
          {
            LoggingUtils.RequireOk (handle);
          }
        }
        catch (Exception e)
        {
          LoggingUtils.HandleException (e);

          throw;
        }
      }

      // 
      // (Managed Code) It is strongly advised that ReleaseComObject be invoked on the various interfaces that are passed to IDebugEventCallback2::Event.
      // 

#if false
      Marshal.ReleaseComObject (pEngine);

      Marshal.ReleaseComObject (pProcess);

      Marshal.ReleaseComObject (pProgram);

      Marshal.ReleaseComObject (pThread);

      Marshal.ReleaseComObject (pEvent);
#endif

      return handle;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int Event (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      // 
      // Custom event handler.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        JavaLangDebuggerEventDelegate eventCallback;

        LoggingUtils.Print ("[JavaLangDebuggerCallback] Event: " + riidEvent.ToString ());

        if (!m_debuggerCallback.TryGetValue (riidEvent, out eventCallback))
        {
          return Constants.E_NOTIMPL;
        }

        LoggingUtils.RequireOk (eventCallback (m_debugEngine.JavaDebugger));

        return Constants.S_OK;

      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        return Constants.E_FAIL;
      }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int OnDebuggerConnectionEvent (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      LoggingUtils.PrintFunction ();

      try
      {
        DebugEngineEvent.DebuggerConnectionEvent debuggerConnectionEvent = pEvent as DebugEngineEvent.DebuggerConnectionEvent;

        switch (debuggerConnectionEvent.Type)
        {
          case DebugEngineEvent.DebuggerConnectionEvent.EventType.ShowDialog:
          {
            LoggingUtils.RequireOk (m_debuggerConnectionService.LaunchDialogShow ());

            break;
          }

          case DebugEngineEvent.DebuggerConnectionEvent.EventType.CloseDialog:
          {
            LoggingUtils.RequireOk (m_debuggerConnectionService.LaunchDialogClose ());

            break;
          }

          case DebugEngineEvent.DebuggerConnectionEvent.EventType.LogStatus:
          case DebugEngineEvent.DebuggerConnectionEvent.EventType.LogError:
          {
            bool isError = (debuggerConnectionEvent.Type == DebugEngineEvent.DebuggerConnectionEvent.EventType.LogError);

            LoggingUtils.RequireOk (m_debuggerConnectionService.LaunchDialogUpdate (debuggerConnectionEvent.Message, isError));

            break;
          }
        }

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

        return VSConstants.E_FAIL;
      }
    }
Exemple #25
0
 AD7EngineCreateEvent(AD7Engine engine)
 {
     m_engine = engine;
 }
 public AD7Events(IDebugEngine2 engine, IDebugEventCallback2 callback)
 {
   _engine = engine;
   _callback = callback;
 }
Exemple #27
0
 //private AD7EngineCreateEvent(AD7Engine engine)
 public AD7EngineCreateEvent(AD7Engine engine)
 {
     _engine = engine;
 }
 public EngineCreate (IDebugEngine2 engine)
 {
   m_engine = engine;
 }
 public DebugEntryPointEvent(IDebugEngine2 mEngine)
 {
   Engine = mEngine;
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int OnProgramDestroy (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)
    {
      LoggingUtils.PrintFunction ();

      try
      {
        if (m_adbLogcatProcess != null)
        {
          m_adbLogcatProcess.Kill ();

          m_adbLogcatProcess.Dispose ();

          m_adbLogcatProcess = null;
        }

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

        return VSConstants.E_FAIL;
      }
    }