Esempio n. 1
0
        /// <summary>
        /// Yields the current program to the debugger if a breakpoint or break condition is satisfied.
        /// </summary>
        public void Yield(ServerProcess process, PlanNode node)
        {
            if (!process.IsLoading())
            {
                try
                {
                    Monitor.Enter(_syncHandle);
                    try
                    {
                        if (ShouldBreak(process, node))
                        {
                            _brokenProcesses.Add(process);
                            InternalPause();
                        }

                        while (_isPauseRequested && _processes.Contains(process))
                        {
                            _pausedCount++;
                            Monitor.Exit(_syncHandle);
                            try
                            {
                                                                #if !SILVERLIGHT
                                WaitHandle.SignalAndWait(_waitSignal, _pauseSignal);
                                                                #endif
                            }
                            finally
                            {
                                Monitor.Enter(_syncHandle);
                                _pausedCount--;
                            }
                        }
                    }
                    finally
                    {
                        Monitor.Exit(_syncHandle);
                    }
                }
                catch
                {
                    // Do nothing, no error should ever be thrown from here
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the list of current debugged processes, with the running status and current location of each.
        /// </summary>
        public List <DebugProcessInfo> GetProcesses()
        {
            List <DebugProcessInfo> processes = new List <DebugProcessInfo>();

            lock (_syncHandle)
            {
                bool isPaused = IsPaused;
                foreach (ServerProcess process in _processes)
                {
                    processes.Add
                    (
                        new DebugProcessInfo
                    {
                        ProcessID = process.ProcessID,
                        IsPaused  = process.IsRunning && isPaused,
                        Location  = (process.IsRunning && isPaused) ? process.ExecutingProgram.SafeGetCurrentLocation() : null,
                        DidBreak  = _brokenProcesses.Contains(process),
                        Error     = (process.IsRunning && isPaused) ? process.ExecutingProgram.Stack.ErrorVar as Exception : null
                    }
                    );
                }
            }
            return(processes);
        }