Пример #1
0
        public void Main()
        {
            Process process = Start();

            Assert.IsTrue(process.IsManaged);
            Assert.IsTrue(process.MainThread.IsStopped);
            Thread thread = process.MainThread;

            AssertStopped(thread, "main", "X.Main()");
            AssertExecute("continue");

            AssertHitBreakpoint(thread, "main2", "X.Main()");

            TargetClassObject a = EvaluateExpression(thread, "a") as TargetClassObject;
            TargetClassObject b = EvaluateExpression(thread, "b") as TargetClassObject;

            Assert.IsTrue(a != null);
            Assert.IsTrue(b != null);

            string text;

            EE.EvaluationResult result;

            result = EE.MonoObjectToString(thread, a, EE.EvaluationFlags.None, 500, out text);

            if (result != ExpressionEvaluator.EvaluationResult.Ok)
            {
                Assert.Fail("Failed to print `a': got result {0}", result);
            }
            if (text != "Foo (3)")
            {
                Assert.Fail("Failed to print `a': got result {0}", text);
            }

            result = EE.MonoObjectToString(thread, b, EE.EvaluationFlags.None, 500, out text);
            if (result != EE.EvaluationResult.Timeout)
            {
                Assert.Fail("Failed to print `a': got result {0}", result);
            }

            AssertExecute("continue");
            AssertTargetOutput("TEST: Foo (3) Foo (8)");
            AssertTargetExited(thread.Process);
        }
Пример #2
0
        string MonoObjectToString(TargetClassObject obj)
        {
            TargetClassType ctype = obj.Type;

            if ((ctype.Name == "System.Object") || (ctype.Name == "System.ValueType"))
            {
                return(null);
            }

            string text, dummy;

            EE.EvaluationResult result;

            if (ctype.DebuggerDisplayAttribute != null)
            {
                result = HandleDebuggerDisplay(Interpreter, CurrentThread, obj,
                                               ctype.DebuggerDisplayAttribute,
                                               -1, out text, out dummy);
                if (result == EE.EvaluationResult.Ok)
                {
                    return(String.Format("{{ {0} }}", text));
                }
                else if (result == EE.EvaluationResult.InvalidExpression)
                {
                    if (text != null)
                    {
                        return(text);
                    }
                }
            }

            result = EE.MonoObjectToString(CurrentThread, obj, EE.EvaluationFlags.None, -1, out text);
            if (result == EE.EvaluationResult.Ok)
            {
                return(String.Format("{{ \"{0}\" }}", text));
            }
            return(null);
        }
Пример #3
0
        public EE.EvaluationResult MonoObjectToString(Thread thread, TargetStructObject obj,
							       EE.EvaluationFlags flags, int timeout,
							       out string text)
        {
            return EE.MonoObjectToString (thread, obj, flags, timeout, out text);
        }
Пример #4
0
        public EE.EvaluationResult GetProperty(Thread thread, TargetPropertyInfo property,
							TargetStructObject instance, EE.EvaluationFlags flags,
							int timeout, out string error, out TargetObject value)
        {
            return EE.GetProperty (thread, property, instance, flags, timeout, out error, out value);
        }
Пример #5
0
        public EE.AsyncResult EvaluateExpressionAsync(StackFrame frame, EE.IExpression expression,
							       EE.EvaluationFlags flags, EE.EvaluationCallback cb)
        {
            return expression.Evaluate (frame, flags, cb);
        }
Пример #6
0
            public EE.AsyncResult Evaluate(StackFrame frame, EE.EvaluationFlags flags,
							EE.EvaluationCallback callback)
            {
                AsyncResult async = new AsyncResult (this);

                ST.ThreadPool.QueueUserWorkItem (delegate {
                    ScriptingContext context = new ScriptingContext (Parser.Interpreter);
                    context.InterruptionHandler = async;
                    context.CurrentFrame = frame;

                    if ((flags & EE.EvaluationFlags.NestedBreakStates) != 0)
                        context.ScriptingFlags |= ScriptingFlags.NestedBreakStates;

                    object data;
                    EE.EvaluationResult result = DoEvaluateWorker (context, out data);
                    callback (result, data);
                    async.WaitHandle.Set ();
                });

                return async;
            }
Пример #7
0
            public EE.AsyncResult Assign(StackFrame frame, TargetObject obj,
						      EE.EvaluationCallback callback)
            {
                AsyncResult async = new AsyncResult (this);

                ST.ThreadPool.QueueUserWorkItem (delegate {
                    ScriptingContext context = new ScriptingContext (Parser.Interpreter);
                    context.InterruptionHandler = async;
                    context.CurrentFrame = frame;

                    object data;
                    EE.EvaluationResult result = DoAssignWorker (
                        context, obj, out data);
                    callback (result, data);
                    async.WaitHandle.Set ();
                });

                return async;
            }