public Breakpoint SetBreakpoint( string tag, int line) { BreakpointKey bpKey = new BreakpointKey() { Tag = tag, Line = line }; Breakpoint bp = null; if (_breakpoints.TryGetValue(bpKey, out bp)) { return bp; } else { bp = new Breakpoint( this ) { Hash = bpKey.Hash, StartLine = line }; _breakpoints.Add( bpKey, bp ); return bp; } }
internal void HitBreakpoint(Breakpoint bp) { if (bp.IsTriggered()) RaiseBreakpoint(bp); }
internal void CheckBreakpoints(int line, int colNumber, CommonTree ct) { int startColumn = 0; int endColumn = UInt16.MaxValue; int startLine = 0; int endLine = 0; RoutineInfo ri = CurrentScope.OwningRoutine; if ( (ct != null) && ( Cmp( ct.Text, "if" ) != 0 ) && ( Cmp( ct.Text, "while" ) != 0 ) && ( Cmp( ct.Text, "repeat" ) != 0 ) && ( Cmp( ct.Text, "loop" ) != 0 ) && ( Cmp( ct.Text, "case_stmt" ) != 0 ) && ( Cmp( ct.Text, "declare_handler" ) != 0 )) { IToken tkStart = ri.TokenStream.Get(ct.TokenStartIndex); IToken tkEnd = ri.TokenStream.Get(ct.TokenStopIndex + 1); if (tkEnd == null) tkEnd = ri.TokenStream.Get(ct.TokenStopIndex); startColumn = tkStart.CharPositionInLine; endColumn = tkEnd.CharPositionInLine + 1; startLine = tkStart.Line; endLine = tkEnd.Line; } else { startLine = endLine = line; startColumn = colNumber; } int hash = GetTagHashCode(ri.SourceCode); string routineName = ri.GetFullName(_utilCon.Database); Breakpoint fakeBreakpoint = new Breakpoint( this ) { StartLine = startLine, EndLine = endLine, IsFake = true, Hash = hash, RoutineName = routineName, StartColumn = startColumn, EndColumn = endColumn }; CurrentScope.CurrentPosition = fakeBreakpoint; // Breakpoints on the same line but different files are treated by making a breakpoint uniquely identified // by line number and hash of current routine source code. if (OnBreakpoint == null) return; if (SteppingType != SteppingTypeEnum.StepOver) { stepOverScope = __scopeLevel; } if (SteppingType == SteppingTypeEnum.StepOver) { bool fireBp = false; if (stepOverScope != -1) { if (__scopeLevel == stepOverScope) { fireBp = true; } } else fireBp = true; if (fireBp) RaiseBreakpoint(fakeBreakpoint); return; } else if (SteppingType == SteppingTypeEnum.StepInto) { RaiseBreakpoint(fakeBreakpoint); return; } else if (SteppingType == SteppingTypeEnum.StepOut) { nextStepOut = _scopeLevel - 1; SteppingType = SteppingTypeEnum.None; } else if (nextStepOut != -1) { if (_scopeLevel == nextStepOut) { nextStepOut = -1; RaiseBreakpoint(fakeBreakpoint); return; } } BreakpointKey bpKey = new BreakpointKey() { Line = line, Hash = hash }; Breakpoint bp = null; if (_breakpoints.TryGetValue(bpKey, out bp) && !bp.Disabled) { stepOverScope = __scopeLevel; HitBreakpoint(bp); } }
internal void RaiseBreakpoint(Breakpoint bp) { if (OnBreakpoint != null) OnBreakpoint(bp); }