Пример #1
0
        //private int m_interruptOperationCounter = 0;

        //private ManualResetEvent m_interruptOperationCompleted = null;

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

        public JavaLangDebugger(DebugEngine debugEngine, DebuggeeProgram debugProgram)
        {
            Engine = debugEngine;

            m_javaLangCallback = new JavaLangDebuggerCallback(debugEngine);

            JavaProgram = new JavaLangDebuggeeProgram(this, debugProgram);

            m_jdbSetup = new JdbSetup(debugProgram.DebugProcess.NativeProcess);

            Engine.Broadcast(new DebugEngineEvent.DebuggerConnectionEvent(DebugEngineEvent.DebuggerConnectionEvent.EventType.LogStatus, string.Format("Configuring JDB for {0}:{1}...", m_jdbSetup.Host, m_jdbSetup.Port)), null, null);

            JdbClient = new JdbClient(m_jdbSetup);

            JdbClient.OnAsyncStdout = OnClientAsyncOutput;

            JdbClient.OnAsyncStderr = OnClientAsyncOutput;

            JdbClient.Start();
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region IDebugExpression2 Members

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

        public int EvaluateAsync(enum_EVALFLAGS evaluateFlags, IDebugEventCallback2 eventCallback)
        {
            //
            // Evaluate the expression asynchronously.
            // Method should return immediately after starting the expression evaluation, when completed successfully
            // a 'IDebugExpressionEvaluationCompleteEvent2' event should be sent to the provided IDebugEventCallback2 callback.
            //

            LoggingUtils.PrintFunction();

            try
            {
                ThreadPool.QueueUserWorkItem(delegate(object state)
                {
                    try
                    {
                        IDebugProperty2 result;

                        IDebugThread2 thread;

                        LoggingUtils.RequireOk(m_stackFrame.GetThread(out thread));

                        LoggingUtils.RequireOk(EvaluateSync(evaluateFlags, 0, eventCallback, out result));

                        m_debugEngine.Broadcast(eventCallback, new DebugEngineEvent.ExpressionEvaluationComplete(this, result), m_debugEngine.Program, thread);
                    }
                    catch (Exception e)
                    {
                        LoggingUtils.HandleException(e);
                    }
                });

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

                return(Constants.E_FAIL);
            }
        }