Mono.Debugger.Frontend.ExpressionParser.ParseLocation C# (CSharp) Метод

ParseLocation() публичный Метод

public ParseLocation ( Thread target, StackFrame frame, LocationType type, string arg ) : SourceLocation
target Thread
frame Mono.Debugger.StackFrame
type LocationType
arg string
Результат Mono.Debugger.SourceLocation
        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);
            }
        }

Same methods

ExpressionParser::ParseLocation ( ScriptingContext context, string arg, SourceLocation &location ) : bool

Usage Example

Пример #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;
            }
        }