コード例 #1
0
ファイル: Debugger.cs プロジェクト: qingemeng/designscript
        public void Defect_1467570_Crash_In_Debug_Mode()
        {
            string src = @" 
class Test 
{   

    IntArray : int[]; 
    
    constructor FirstApproach(intArray : int[]) 
    { 
        IntArray = intArray; 
    } 
    
    def Transform(adjust : int) 
    { 
        return = Test.FirstApproach(this.IntArray + adjust); 
    } 
        
} 

myTest = Test.FirstApproach({ 1, 2 }); 

myNeTwst = myTest.Transform(1); 
";

            fsr.PreStart(src, runnerConfig);
            DebugRunner.VMState vms = fsr.Step();   // myTest = Test.FirstApproach({ 1, 2 });

            ProtoCore.CodeModel.CodePoint cp = new ProtoCore.CodeModel.CodePoint
            {
                LineNo = 15,
                CharNo = 5
            };

            fsr.ToggleBreakpoint(cp);
            fsr.Run();  // line containing "this"

            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, null);
            ExecutionMirror             mirror      = watchRunner.Execute(@"this");
            Obj objExecVal = mirror.GetWatchValue();

            Assert.AreNotEqual(null, objExecVal);
            Assert.AreNotEqual(null, objExecVal.Payload);
            Assert.AreEqual(mirror.GetType(objExecVal), "Test");

            vms = fsr.StepOver();

            watchRunner = new ExpressionInterpreterRunner(core, null);
            mirror      = watchRunner.Execute(@"this");
            objExecVal  = mirror.GetWatchValue();
            Assert.AreNotEqual(null, objExecVal);
            Assert.AreEqual(-1, (Int64)objExecVal.Payload);
            Assert.AreEqual(mirror.GetType(objExecVal), "null");
        }
コード例 #2
0
ファイル: Debugger.cs プロジェクト: yaoclee/Dynamo
        public void Defect_1467570_Crash_In_Debug_Mode()
        {
            string src = @" 
class Test 
{   
    IntArray : int[]; 
    
    constructor FirstApproach(intArray : int[]) 
    { 
        IntArray = intArray; 
    } 
    
    def Transform(adjust : int) 
    { 
        return = Test.FirstApproach(this.IntArray + adjust); 
    } 
        
} 
myTest = Test.FirstApproach({ 1, 2 }); 
myNeTwst = myTest.Transform(1); 
";
            // Tracked by http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-3989
            string defectID = "MAGN-3989 Inspection of 'this' pointer has issues in expression interpreter";

            fsr.PreStart(src);
            DebugRunner.VMState           vms = fsr.Step(); // myTest = Test.FirstApproach({ 1, 2 });
            ProtoCore.CodeModel.CodePoint cp  = new ProtoCore.CodeModel.CodePoint
            {
                LineNo = 15,
                CharNo = 5
            };

            fsr.ToggleBreakpoint(cp);
            fsr.Run();  // line containing "this"

            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            ExecutionMirror             mirror      = watchRunner.Execute(@"this");
            Obj objExecVal = mirror.GetWatchValue();

            Assert.AreNotEqual(null, objExecVal);
            Assert.AreNotEqual(null, objExecVal.Payload, defectID);
            Assert.AreEqual(mirror.GetType(objExecVal), "Test");
            vms = fsr.StepOver();

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            mirror      = watchRunner.Execute(@"this");
            objExecVal  = mirror.GetWatchValue();
            Assert.AreNotEqual(null, objExecVal);
            Assert.AreEqual(-1, (Int64)objExecVal.Payload, defectID);
            Assert.AreEqual(mirror.GetType(objExecVal), "null");
        }
コード例 #3
0
ファイル: EventTest.cs プロジェクト: santom/designscript
        private Obj GetWatchValue(ProtoCore.Core core, string watchExpression)
        {
            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core);
            ExecutionMirror             mirror      = watchRunner.Execute(watchExpression);

            return(mirror.GetWatchValue());
        }
コード例 #4
0
        private bool InterpretExpression(string expression)
        {
            if ((null != internalWorker) && internalWorker.IsBusy)
            {
                return(false); // Sorry but we're kinda busy right now.
            }
            if (string.IsNullOrEmpty(expression))
            {
                return(false);
            }

            Logger.LogInfo("InterpretExpression", expression);
            if (null == this.core || (null == debugRunner))
            {
                return(false); // Only in debug mode.
            }
            currentWatchedStackValue = null;
            ExpressionInterpreterRunner exprInterpreter = null;

            IOutputStream buildStream   = core.BuildStatus.MessageHandler;
            IOutputStream runtimeStream = core.RuntimeStatus.MessageHandler;

            // Disable output before interpret expression.
            core.BuildStatus.MessageHandler   = null;
            core.RuntimeStatus.MessageHandler = null;
            exprInterpreter = new ExpressionInterpreterRunner(this.core);

            try
            {
                currentWatchedStackValue = ExecExecutiveExpression(exprInterpreter, expression);
                if (currentWatchedStackValue == null)
                {
                    currentWatchedMirror = exprInterpreter.Execute(expression);
                    if (null != currentWatchedMirror)
                    {
                        currentWatchedStackValue = currentWatchedMirror.GetWatchValue();
                    }
                }
            }
            catch (ProtoCore.Exceptions.CompileErrorsOccured compileError)
            {
            }
            catch (Exception exception)
            {
            }

            // Re-enable output after execution is done.
            core.BuildStatus.MessageHandler   = buildStream;
            core.RuntimeStatus.MessageHandler = runtimeStream;
            return(null != currentWatchedStackValue);
        }