public SourceLocation ParseLocation(Thread target, StackFrame frame, LocationType type, string arg) { ScriptingContext context = new ScriptingContext (Interpreter); context.CurrentThread = target; context.CurrentFrame = frame; try { return DoParse (context, type, arg); } catch (ScriptingException ex) { throw new TargetException (TargetError.LocationInvalid, ex.Message); } }
/// <summary> Toggle breakpoint at given location </summary> public void ToggleBreakpoint(string filename, int line) { // Try to find a breakpoint at current location foreach (Event breakpoint in interpreter.Session.Events) { if (breakpoint is SourceBreakpoint) { SourceLocation location = ((SourceBreakpoint)breakpoint).Location; if (location != null && location.FileName == filename && location.Line == line) { interpreter.Session.DeleteEvent(breakpoint); breakpointsStore.UpdateTree(); return; } } } // Add breakpoint at current location if (interpreter.HasTarget && interpreter.HasCurrentThread) { try { SourceLocation newLocation; ExpressionParser.ParseLocation(interpreter.CurrentThread, interpreter.CurrentThread.CurrentFrame, line.ToString(), out newLocation); Event newBreakpoint = interpreter.Session.InsertBreakpoint(ThreadGroup.Global, newLocation); newBreakpoint.Activate(interpreter.CurrentThread); } catch { } breakpointsStore.UpdateTree(); return; } }