ParseLocation() public method

public ParseLocation ( Thread target, StackFrame frame, LocationType type, string arg ) : SourceLocation
target Thread
frame Mono.Debugger.StackFrame
type LocationType
arg string
return Mono.Debugger.SourceLocation
Exemplo n.º 1
0
        /// <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;
            }
        }