private void AddBreakpoint() { if (_breakpoint != null && !Breakpoints.Contains(_breakpoint.Value)) { Breakpoints.Add(_breakpoint.Value); _console.SetBreakpoint(_breakpoint.Value); } }
public bool DeleteBreakpoint(ProgramBreakpoint breakpoint) { if (Breakpoints.Contains(breakpoint)) { Breakpoints.Remove(breakpoint); return(true); } return(false); }
private void CpuLoop() { bool enabled = true; while (enabled) { if (WaitHandle.WaitAny(new WaitHandle[] { _continueSignal, _terminateSignal }) == 1) { enabled = false; } else { Running = true; _continueSignal.Reset(); OnResumed(); int cycles = 0; do { cycles += CpuStep(); if (cycles >= 70224) { _frames++; _device.Spu.SpuStep(cycles); cycles -= 70224; if (EnableFrameLimit) { WaitHandle.WaitAny(new WaitHandle[] { _breakSignal, _frameStartSignal }); _frameStartSignal.Reset(); } } if (Breakpoints.Contains(Registers.PC)) { _break = true; } } while (!_break); _breakSignal.Reset(); Running = false; OnPaused(); } } OnTerminated(); }
private void ExecuteDebugStep() { MyExecutionBlock currentBlock = CurrentDebuggedBlock; if (currentBlock == null) { if (m_executionPhase == ExecutionPhase.Initialization) { // The next step should be the beginning of the initialization plan. if (ExecutionPlan.InitStepPlan != null) { // There is an initialization plan, take the first step. ExecutionPlan.InitStepPlan.Reset(); currentBlock = ExecutionPlan.InitStepPlan; } else { // There is no initialization plan, go to PreStandard and stop because the loading of // block data might be needed. m_executionPhase = ExecutionPhase.PreStandard; return; } } else if (m_executionPhase == ExecutionPhase.Standard) { ExecutionPlan.StandardStepPlan.Reset(); currentBlock = ExecutionPlan.StandardStepPlan; } } // This checks if breakpoint was encountered, also used for "stepping". bool leavingTargetBlock = false; do { currentBlock.SimulationStep = SimulationStep; currentBlock = currentBlock.ExecuteStep(); if (StopWhenTouchedBlock != null && currentBlock == StopWhenTouchedBlock) { leavingTargetBlock = true; } } while (currentBlock != null && currentBlock.CurrentChild == null); if (currentBlock == null) { // The current plan finished. if (m_executionPhase == ExecutionPhase.Initialization) { // This means the init plan got finished, not the standard plan. m_stepComplete = false; } else { // This means the standard plan finished, remove the init plan (debug window will reset). ExecutionPlan.InitStepPlan = null; } // If rescheduling happens, this will be set to "Initialization" again, if not, we need to // perform just the standard plan again. m_executionPhase = ExecutionPhase.PreStandard; leavingTargetBlock = true; } else { m_stepComplete = false; } CurrentDebuggedBlock = currentBlock; if (DebugStepMode != DebugStepMode.None) { // A step into/over/out is performed. if (leavingTargetBlock) { // The target block is being left or the sim step is over - step over/out is finished. EmitDebugTargetReached(); } if (DebugStepMode == DebugStepMode.StepInto) { // Step into == one step of the simulation. EmitDebugTargetReached(); } } if (currentBlock != null && Breakpoints.Contains(currentBlock.CurrentChild)) { // A breakpoint has been reached. EmitDebugTargetReached(); } }
public bool Contains(Breakpoint item) { lock (this) return(Breakpoints.Contains(item)); }