Debug callbacks called during WaitForEvent callback. This class in future can be extended to support callbacks provided on certain actions (e.g. breakpoint hit, thread create, module load etc.)
Наследование: IDebugEventCallbacks
Пример #1
0
        /// <summary>
        /// Loop responsible to wait for debug events.
        /// Needs to be run in separate thread.
        /// </summary>
        private void DebuggerStateLoop()
        {
            bool           hasClientExited = false;
            IDebugControl7 loopControl     = (IDebugControl7)client;
            DebugCallbacks eventCallbacks  = new DebugCallbacks(client, DebugStatusGo);

            lock (eventCallbacksReady)
            {
                System.Threading.Monitor.Pulse(eventCallbacksReady);
            }

            // Default is to start in break mode, wait for release.
            //
            DebugStatusGo.WaitOne();

            while (!hasClientExited)
            {
                loopControl.WaitForEvent(0, UInt32.MaxValue);
                uint executionStatus = loopControl.GetExecutionStatus();

                while (executionStatus == (uint)Defines.DebugStatusBreak)
                {
                    DebugStatusBreak.Set();
                    DebugStatusGo.WaitOne();

                    executionStatus = loopControl.GetExecutionStatus();
                }

                hasClientExited = executionStatus == (uint)Defines.DebugStatusNoDebuggee;
            }
        }
Пример #2
0
        /// <summary>
        /// Loop responsible to wait for debug events.
        /// Needs to be run in separate thread.
        /// </summary>
        private void DebuggerStateLoop()
        {
            bool           hasClientExited = false;
            IDebugControl7 loopControl     = dbgEngDll.Control;

            debugCallbacks = new DebugCallbacks(loopControl, DebugStatusGo);
            dbgEngDll.ThreadClient.SetEventCallbacks(debugCallbacks);

            lock (eventCallbacksReady)
            {
                System.Threading.Monitor.Pulse(eventCallbacksReady);
            }

            // Default is to start in break mode, wait for the release.
            // TODO: Needs to be changes with support for non-intrusive debugging.
            //
            DebugStatusGo.WaitOne();

            while (!hasClientExited)
            {
                // Need to check hr return value.
                //
                loopControl.WaitForEvent(0, uint.MaxValue);

                if ((uint)Defines.DebugStatusBreak == loopControl.GetExecutionStatus())
                {
                    dbgEngDll.ThreadClient.DispatchCallbacks(200);
                    DebugStatusBreak.Set();
                    DebugStatusGo.WaitOne();

                    if (DebuggerLoopExitSignal)
                    {
                        dbgEngDll.ThreadClient.EndSession(DebugEnd.ActiveTerminate);
                    }
                    else
                    {
                        loopControl.Execute(0, "g", 0);
                    }

                    dbgEngDll.ThreadClient.DispatchCallbacks(200);
                }

                hasClientExited = loopControl.GetExecutionStatus() == (uint)Defines.DebugStatusNoDebuggee;
            }
        }
        /// <summary>
        /// Loop responsible to wait for debug events.
        /// Needs to be run in separate thread.
        /// </summary>
        private void DebuggerStateLoop()
        {
            bool hasClientExited = false;
            IDebugControl7 loopControl = (IDebugControl7)client;
            DebugCallbacks eventCallbacks = new DebugCallbacks(client, DebugStatusGo);

            lock (eventCallbacksReady)
            {
                System.Threading.Monitor.Pulse(eventCallbacksReady);
            }

            // Default is to start in break mode, wait for release.
            //
            DebugStatusGo.WaitOne();

            while (!hasClientExited)
            {
                loopControl.WaitForEvent(0, UInt32.MaxValue);
                uint executionStatus = loopControl.GetExecutionStatus();

                while (executionStatus == (uint)Defines.DebugStatusBreak)
                {
                    DebugStatusBreak.Set();
                    DebugStatusGo.WaitOne();

                    executionStatus = loopControl.GetExecutionStatus();
                }

                hasClientExited = executionStatus == (uint)Defines.DebugStatusNoDebuggee;
            }
        }