public ProtoCore.Mirror.RuntimeMirror LookupName(string name, int blockID) { // TODO Jun: The expression interpreter must be integrated into the mirror core.Rmem.PushConstructBlockId(blockID); core.DebugProps.CurrentBlockId = blockID; ProtoScript.Runners.ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core); List <ProtoCore.Core.CodeBlockCompilationSnapshot> snapShots = null; if (core.Options.IsDeltaExecution) { snapShots = ProtoCore.Core.CodeBlockCompilationSnapshot.CaptureCoreCompileState(core); } ProtoCore.DSASM.Mirror.ExecutionMirror mirror = watchRunner.Execute(name); if (core.Options.IsDeltaExecution && snapShots != null) { core.ResetDeltaCompileFromSnapshot(snapShots); } ProtoCore.Lang.Obj objExecVal = mirror.GetWatchValue(); ProtoCore.Mirror.RuntimeMirror runtimeMirror = new ProtoCore.Mirror.RuntimeMirror(new ProtoCore.Mirror.MirrorData(core, objExecVal.DsasmValue), core, core); Validity.Assert(runtimeMirror != null); return(runtimeMirror); }
internal bool GetStackValueType(ProtoCore.Lang.Obj stackValue, ref string type) { type = string.Empty; if ((null != internalWorker) && internalWorker.IsBusy) { return(false); } if (null == currentWatchedMirror) { return(false); } try { type = currentWatchedMirror.GetType(stackValue); } catch (Exception exception) { HandleException(exception); return(false); } return(true); }
internal bool GetStackValueData(ProtoCore.Lang.Obj stackValue, ref string data) { data = string.Empty; if ((null != internalWorker) && internalWorker.IsBusy) { return(false); } if (null == currentWatchedMirror) { return(false); } try { ITextEditorSettings editorSettings = TextEditorCore.Instance.TextEditorSettings; data = currentWatchedMirror.GetStringValue(stackValue.DsasmValue, core.Heap, 0, editorSettings.MaxArrayDisplaySize, editorSettings.MaxOutputDepth); } catch (Exception exception) { HandleException(exception); return(false); } return(true); }
public bool GetClassProperties(ProtoCore.Lang.Obj stackValue, out Dictionary <string, ProtoCore.Lang.Obj> properties) { properties = null; if (null == vmWorker) { return(false); } return(vmWorker.GetClassProperties(stackValue, out properties)); }
public bool GetArrayElements(ProtoCore.Lang.Obj stackValue, out List <ProtoCore.Lang.Obj> elements) { elements = null; if (null == vmWorker) { return(false); } return(vmWorker.GetArrayElements(stackValue, out elements)); }
public bool GetStackValue(string expression, out ProtoCore.Lang.Obj value) { value = null; if (null == vmWorker) { return(false); } return(vmWorker.GetStackValue(expression, out value)); }
public bool GetStackValueType(ProtoCore.Lang.Obj stackValue, ref string type) { type = string.Empty; if (null == vmWorker) { return(false); } return(vmWorker.GetStackValueType(stackValue, ref type)); }
public bool GetStackValueData(ProtoCore.Lang.Obj stackValue, ref string data) { data = string.Empty; if (null == vmWorker) { return(false); } return(vmWorker.GetStackValueData(stackValue, ref data)); }
internal bool GetStackValue(string expression, out ProtoCore.Lang.Obj value) { value = null; if (InterpretExpression(expression) != false) { value = currentWatchedStackValue; } return(true); // Call is successful. }
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); }
internal bool GetClassProperties(ProtoCore.Lang.Obj stackValue, out Dictionary <string, ProtoCore.Lang.Obj> properties) { properties = null; if ((null != internalWorker) && internalWorker.IsBusy) { return(false); // Sorry but we're kinda busy right now. } try { if (null != currentWatchedMirror) { properties = currentWatchedMirror.GetProperties(stackValue, true); } } catch (Exception exception) { HandleException(exception); return(false); } return(true); // Call's successful even when there's no mirror. }
internal bool GetArrayElements(ProtoCore.Lang.Obj stackValue, out List <ProtoCore.Lang.Obj> elements) { elements = null; // Invalidate output argument. if ((null != internalWorker) && internalWorker.IsBusy) { return(false); // Sorry but we're kinda busy right now. } try { if (null != currentWatchedMirror) { elements = currentWatchedMirror.GetArrayElements(stackValue); } } catch (Exception exception) { HandleException(exception); return(false); } return(true); // Call is successful. }
private void CleanUpRunners() { Logger.LogInfo("DetachFromDebugger", "Detach"); // Clear up all watch related data members. this.workerParams.CurrentVmState = null; this.currentWatchedMirror = null; this.currentWatchedStackValue = null; if (null != scriptRunner) { scriptRunner = null; } if (null != debugRunner) { debugRunner.Shutdown(); debugRunner = null; } if (null != internalWorker) { // @TODO(Ben): Perhaps cancellation is needed? internalWorker = null; } //Fix DG-1464973 Sprint25: rev 3444 : Multiple import issue - dispose core after execution //Core Cleanup should happen only after execution has finished, //DebugRunner is ShutDown. if (null != this.core) { this.core.Cleanup(); this.core = null; } workerParams.ResetStates(); SetExecutionState(ExecutionStateChangedEventArgs.States.None); }
public void TestDynamicArray001() { String code = @" local; [Imperative] { range = 1..10; local = {}; c = 0; for(i in range) { local[c] = i + 1; c = c + 1; } } "; ExecutionMirror mirror = thisTest.RunScriptSource(code); ProtoCore.Lang.Obj o = mirror.GetFirstValue("local"); ProtoCore.DSASM.Mirror.DsasmArray arr = (ProtoCore.DSASM.Mirror.DsasmArray)o.Payload; Assert.IsTrue((Int64)arr.members[0].Payload == 2); }
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); }
private void CleanUpRunners() { Logger.LogInfo("DetachFromDebugger", "Detach"); // Clear up all watch related data members. this.workerParams.CurrentVmState = null; this.currentWatchedMirror = null; this.currentWatchedStackValue = null; if (null != scriptRunner) scriptRunner = null; if (null != debugRunner) { debugRunner.Shutdown(); debugRunner = null; } if (null != internalWorker) { // @TODO(Ben): Perhaps cancellation is needed? internalWorker = null; } //Fix DG-1464973 Sprint25: rev 3444 : Multiple import issue - dispose core after execution //Core Cleanup should happen only after execution has finished, //DebugRunner is ShutDown. if (null != this.core) { this.core.Cleanup(); this.core = null; } workerParams.ResetStates(); SetExecutionState(ExecutionStateChangedEventArgs.States.None); }