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

        public CLangDebuggerCallback(DebugEngine engine)
        {
            m_debugEngine = engine;

            //
            // Register function handlers for specific events.
            //

            m_debuggerCallback = new Dictionary <Guid, CLangDebuggerEventDelegate>
            {
                { ComUtils.GuidOf(typeof(CLangDebuggerEvent.StartServer)), OnStartServer },

                { ComUtils.GuidOf(typeof(CLangDebuggerEvent.TerminateServer)), OnTerminateServer },

                { ComUtils.GuidOf(typeof(CLangDebuggerEvent.AttachClient)), OnAttachClient },

                { ComUtils.GuidOf(typeof(CLangDebuggerEvent.DetachClient)), OnDetachClient },

                { ComUtils.GuidOf(typeof(CLangDebuggerEvent.StopClient)), OnStopClient },

                { ComUtils.GuidOf(typeof(CLangDebuggerEvent.ContinueClient)), OnContinueClient },

                { ComUtils.GuidOf(typeof(CLangDebuggerEvent.TerminateClient)), OnTerminateClient }
            };
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public void GetConnectionInterface(out Guid pIID)
        {
            //
            // Returns the IID of the outgoing interface managed by this connection point.
            //

            LoggingUtils.PrintFunction();

            pIID = ComUtils.GuidOf(typeof(IDebugPortEvents2));
        }
예제 #3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebugEngineCallback(DebugEngine engine, IDebugEventCallback2 ad7EventCallback)
        {
            Engine = engine;

            m_ad7EventCallback = ad7EventCallback;

            m_cLangEventCallback = new CLangDebuggerCallback(engine);

            m_javaLangEventCallback = new JavaLangDebuggerCallback(engine);

            //
            // Register function handlers for specific events.
            //

            m_debuggerCallback = new Dictionary <Guid, DebuggerEventDelegate> ();

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.BreakpointHit)), OnBreakpoint);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.BreakpointBound)), OnBreakpointBound);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.BreakpointError)), OnBreakpointError);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.Error)), OnError);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.Exception)), OnException);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.LoadComplete)), OnLoadComplete);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ModuleLoad)), OnModuleLoad);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.OutputString)), OnOutputString);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ProcessCreate)), OnProgramCreate);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ProgramDestroy)), OnProgramDestroy);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.StepComplete)), OnStepComplete);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.SymbolSearch)), OnSymbolSearch);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ThreadCreate)), OnThreadCreate);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ThreadDestroy)), OnThreadDestroy);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public JavaLangDebuggerCallback(DebugEngine engine)
        {
            m_debugEngine = engine;

            //
            // Register function handlers for specific events.
            //

            m_debuggerCallback = new Dictionary <Guid, JavaLangDebuggerEventDelegate> ();

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(JavaLangDebuggerEvent.AttachClient)), OnAttachClient);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(JavaLangDebuggerEvent.DetachClient)), OnDetachClient);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(JavaLangDebuggerEvent.StopClient)), OnStopClient);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(JavaLangDebuggerEvent.ContinueClient)), OnContinueClient);

            m_debuggerCallback.Add(ComUtils.GuidOf(typeof(JavaLangDebuggerEvent.TerminateClient)), OnTerminateClient);
        }
예제 #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int AddProgramNode(IDebugProgramNode2 pProgramNode)
        {
            //
            // Registers a program that can be debugged with the port it is running on.
            //

            LoggingUtils.PrintFunction();

            try
            {
                IDebugProcess2 process;

                DebuggeeProgram program = pProgramNode as DebuggeeProgram;

                LoggingUtils.RequireOk(program.GetProcess(out process));

                foreach (IDebugPortEvents2 connectionPoint in m_eventConnectionPoints.Values)
                {
                    ProgramCreate debugEvent = new ProgramCreate();

                    Guid eventGuid = ComUtils.GuidOf(debugEvent);

                    int handle = connectionPoint.Event(null, this, process, program, debugEvent, ref eventGuid);

                    if (handle == unchecked ((int)0x80010108)) // RPC_E_DISCONNECTED
                    {
                        continue;                              // Connection point was previously used.
                    }

                    LoggingUtils.RequireOk(handle);
                }

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

                return(Constants.E_FAIL);
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebuggerEventListener(EnvDTE.DTE dteService, IVsDebugger debuggerService, IDebuggerConnectionService debuggerConnectionService)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            m_dteService = dteService;

            m_debuggerService = debuggerService;

            m_debuggerConnectionService = debuggerConnectionService;

            LoggingUtils.RequireOk(m_debuggerService.AdviseDebuggerEvents(this, out m_debuggerServiceCookie));

            LoggingUtils.RequireOk(m_debuggerService.AdviseDebugEventCallback(this));

            //
            // Register required listener events and paired process function callbacks.
            //

            m_eventCallbacks = new Dictionary <Guid, DebuggerEventListenerDelegate> ();

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.SessionCreate)), OnSessionCreate);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.SessionDestroy)), OnSessionDestroy);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.EngineCreate)), OnEngineCreate);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ProgramCreate)), OnProgramCreate);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ProgramDestroy)), OnProgramDestroy);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.AttachComplete)), OnAttachComplete);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.Error)), OnError);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.DebuggerConnectionEvent)), OnDebuggerConnectionEvent);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.DebuggerLogcatEvent)), OnDebuggerLogcatEvent);
        }