public static void AddOperation(IActivityScope scope, ActivityOperationType operation, string instance, float value = 0f, int count = 1) { bool flag = false; IActivityScope activityScope = ActivityContext.globalScope; TimeInResourcePerfCounter.AddOperation(operation, value); if (scope != null && scope.Status == ActivityContextStatus.ActivityStarted) { flag = scope.AddOperation(operation, instance, value, count); } if (!ActivityContext.IsGlobalScopeEnabled) { return; } if (flag) { activityScope.AddOperation(operation, "INSTR", value, count); return; } if (scope != null || SingleContext.Singleton.LocalId != null) { activityScope.AddOperation(operation, "MISSED", value, count); return; } if (DebugContext.GetDebugProperty(DebugProperties.ActivityId) == null) { activityScope.AddOperation(operation, "UNINSTR", value, count); return; } activityScope.AddOperation(operation, "SUPPR", value, count); }
public BindingAction(Action <TContext> action, string key, DebugContext debugContext, bool runOnAttach) { Action = action; Key = key; DebugContext = debugContext; RunOnAttach = runOnAttach; }
private void CreateFunctionInfo(MSAst.LambdaExpression generatorFactoryLambda) { if (_lambdaInfo.CompilerSupport != null && _lambdaInfo.CompilerSupport.DoesExpressionNeedReduction(generatorFactoryLambda)) { _functionInfo = _lambdaInfo.CompilerSupport.QueueExpressionForReduction( Ast.Call( typeof(RuntimeOps).GetMethod("CreateFunctionInfo"), generatorFactoryLambda, AstUtils.Constant(_alias), AstUtils.Constant(_debugMarkerLocationMap, typeof(object)), AstUtils.Constant(_variableScopeMap, typeof(object)), AstUtils.Constant(_variableInfos, typeof(object)), Ast.Constant(_lambdaInfo.CustomPayload, typeof(object)) ) ); } else { _functionInfo = Ast.Constant( DebugContext.CreateFunctionInfo( generatorFactoryLambda.Compile(), _alias, _debugMarkerLocationMap, _variableScopeMap, _variableInfos, _lambdaInfo.CustomPayload), typeof(FunctionInfo)); } }
public void Load_order_history() { var order = MakeSentOrder(); var catalog = session.Load <Catalog>(order.Lines[0].CatalogId); DebugContext.Add("CatalogId", catalog.Id); StartWait(); Click("ShowCatalog"); var catalogModel = (CatalogViewModel)shell.ActiveItem; var viewModel = (CatalogNameViewModel)catalogModel.ActiveItem; var view = (FrameworkElement)viewModel.GetView(); dispatcher.Invoke(() => { var names = (DataGrid)view.FindName("CatalogNames"); names.SelectedItem = names.ItemsSource.Cast <CatalogName>().First(n => n.Id == catalog.Name.Id); }); WaitIdle(); dispatcher.Invoke(() => { var catalogs = (DataGrid)view.FindName("Catalogs"); catalogs.SelectedItem = catalogs.ItemsSource.Cast <Catalog>().First(n => n.Id == catalog.Id); }); Input(view, "CatalogNames", Key.Enter); if (viewModel.Catalogs.Value.Count > 1) { Input(view, "Catalogs", Key.Enter); } AdvanceScheduler(3000); dispatcher.Invoke(() => { var element = (FrameworkElement)((Screen)shell.ActiveItem).GetView(); var grid = (DataGrid)element.FindName("HistoryOrders"); Assert.That(grid.Items.Count, Is.GreaterThan(0)); }); }
/// <summary></summary> public LuaTraceLineDebugger() { callback = new TraceCallback(this); context = DebugContext.CreateInstance(); pipeline = TracePipeline.CreateInstance(context); pipeline.TraceCallback = callback; } // ctor
public App(DebugContext context) { CurrentContext = context; InitializeComponent(); MainWindow = new WndMain(); MainWindow.Show(); }
private TracePipeline(DebugContext debugContext) { _debugContext = debugContext; _traceFrame = new ThreadLocal <DebugFrame>(); debugContext.DebugCallback = this; debugContext.DebugMode = DebugMode.FullyEnabled; }
internal static void Log(DebugContext context, string msg, [CallerFilePath] string callerFile = "?", [CallerMemberName] string callerMember = "?") { if (((int)Context & (int)context) == 0) { return; } Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}]{Path.GetFileNameWithoutExtension(callerFile)}.{callerMember}: {msg}"); }
public virtual void Clear() { Points.Clear(); if (DebugContext != null) { DebugContext.Clear(); } StepCount = 0; }
private Processor(Processor parentProcessor) { m_Debug = parentProcessor.m_Debug; m_RootChunk = parentProcessor.m_RootChunk; m_GlobalTable = parentProcessor.m_GlobalTable; m_Script = parentProcessor.m_Script; m_Parent = parentProcessor; m_State = CoroutineState.NotStarted; }
public static void SetThreadScope(IActivityScope activityScope) { ActivityContext.ClearThreadScope(); if (activityScope != null && activityScope.Status == ActivityContextStatus.ActivityStarted) { SingleContext.Singleton.LocalId = new Guid?(activityScope.LocalId); DebugContext.UpdateFrom(activityScope); } }
public static FunctionInfo CreateFunctionInfo( Delegate generatorFactory, string name, object locationSpanMap, object scopedVariables, object variables, object customPayload) { return(DebugContext.CreateFunctionInfo(generatorFactory, name, (DebugSourceSpan[])locationSpanMap, (IList <VariableInfo>[])scopedVariables, (IList <VariableInfo>)variables, customPayload)); }
public override bool Enter(ControlContext context, DebugViewContext debug) { if (base.Enter(context, debug)) { DebugContext.DisableAllViews(); return(true); } return(false); }
private Processor(Processor parentProcessor) { m_ValueStack = new FastStack <DynValue>(STACK_SIZE); m_ExecutionStack = new FastStack <CallStackItem>(STACK_SIZE); m_Debug = parentProcessor.m_Debug; m_RootChunk = parentProcessor.m_RootChunk; m_GlobalTable = parentProcessor.m_GlobalTable; m_Script = parentProcessor.m_Script; m_Parent = parentProcessor; m_State = CoroutineState.NotStarted; }
public Processor(Script script, Table globalContext, ByteCode byteCode) { m_CoroutinesStack = new List <Processor>(); m_Debug = new DebugContext(); m_RootChunk = byteCode; m_GlobalTable = globalContext; m_Script = script; m_State = CoroutineState.Main; DynValue.NewCoroutine(new Coroutine(this)); // creates an associated coroutine for the main processor }
public Processor(Script script, Table globalContext, ByteCode byteCode) { m_CoroutinesStack = new List<Processor>(); m_Debug = new DebugContext(); m_RootChunk = byteCode; m_GlobalTable = globalContext; m_Script = script; m_State = CoroutineState.Main; DynValue.NewCoroutine(new Coroutine(this)); // creates an associated coroutine for the main processor }
public static ITracePipeline CreateInstance(DebugContext debugContext) { ContractUtils.RequiresNotNull(debugContext, "debugContext"); if (debugContext.DebugCallback != null) { throw new InvalidOperationException(ErrorStrings.DebugContextAlreadyConnectedToTracePipeline); } return(new TracePipeline(debugContext)); }
//Takes the value and execution stack from recycleProcessor internal Processor(Processor parentProcessor, Processor recycleProcessor) { m_ValueStack = recycleProcessor.m_ValueStack; m_ExecutionStack = recycleProcessor.m_ExecutionStack; m_Debug = parentProcessor.m_Debug; m_RootChunk = parentProcessor.m_RootChunk; m_GlobalTable = parentProcessor.m_GlobalTable; m_Script = parentProcessor.m_Script; m_Parent = parentProcessor; m_State = CoroutineState.NotStarted; }
private static void Run(string[] args) { // when running from cmd, attach to the cmd console string path = ""; if (args.Length > 0) { if (args[0].StartsWith("-")) { args[0] = "?"; } switch (args[0]) { case "?": string output = ""; output += "\nSA3D Standalone @X-Hax\n"; output += " Usage: [filepath] [options]\n\n"; output += " filepath\n"; output += " Path to a sonic adventure level or model file that should be opened\n\n"; output += " Options:\n"; output += " -h --help Help \n\n"; output += " -tex --textures\n"; output += " Loads a texture archive.\n\n"; output += " -mtn --motion\n"; output += " Loads a motion file and attaches it to the loaded model.\n\n\n"; output += " -st --standlone\n"; output += " Starts SA3D as a standalone window (only used for model inspection).\n\n"; output += " -res --resolution [Width]x[Height]\n"; output += " Used to start the standalone with specific dimensions.\n\n"; Console.WriteLine(output); return; default: path = Path.Combine(Environment.CurrentDirectory, args[0]); if (!File.Exists(path)) { Console.WriteLine("Path does not lead to a file! enter --help for more info"); return; } break; } } DebugContext context = OpenGLBridge.CreateGLDebugContext(default);
public virtual void Clear() { this.Points.Clear(); this.Triangles.Clear(); if (DebugContext != null) { DebugContext.Clear(); } #if DEBUG dbugStepCount = 0; #endif }
public void Execute_StringWithMultipleOperations_OrderedOperations() { //PEMDAS FLCompiler compiler = BasicArithmeticTestCompiler(); DebugContext context = new DebugContext(); string operators = ""; context.Operated += (symbol, left, right) => { operators += symbol; }; compiler.Execute("10 + 10 - (15 - 15 * 25 / 25 * (25 / 10)) / 100", context); Assert.AreEqual("+*//*-/-", operators); }
public void Build() { ApplicationContext.Init(_applicationContext); BusinessProcessContext.Init(new BusinessProcess.BusinessProcessContext()); IOContext.Init(new IO.IOContext(_applicationContext)); ControlsContext.Init(new Controls.ControlsContext()); DbContext.Init(new DbEngine.DbContext()); ExpressionContext.Init(new ExpressionEvaluator.ExpressionContext(_applicationContext)); ValueStackContext.Init(new ValueStack.ValueStackContext(DbContext.Current, ExpressionContext.Current)); ScriptEngineContext.Init(new ScriptEngine.ScriptEngineContext()); InitLogManager(); DebugContext.Init(new Debugger.DebugContext()); SyncContext.Init(new SyncLibrary.SyncContext()); DalContext.Init(new DataAccessLayer.DalContext()); StyleSheetContext.Init(new StyleSheet.StyleSheetContext()); InitEntityFactory(); }
public void DebugContextRaisingSettingValueEvent() { IContext context = new Context(); DebugContext debug = new DebugContext(context); string varname = null; object varvalue = null; debug.SettingValue += (name, value) => { varname = name; varvalue = value; }; ICommand command = new SetCommand("foo", new ConstantExpression("bar")); command.Execute(debug); Assert.AreEqual("foo", varname); Assert.AreEqual("bar", varvalue); }
public void DebugContextRaisingGettingValueEvent() { IContext context = new Context(); context.SetValue("foo", "bar"); DebugContext debug = new DebugContext(context); string varname = null; object varvalue = null; debug.GettingValue += (name, value) => { varname = name; varvalue = value; }; IExpression expression = new VariableExpression("foo"); expression.Evaluate(debug); Assert.AreEqual("foo", varname); Assert.AreEqual("bar", varvalue); }
internal DebuggableLambdaBuilder(DebugContext debugContext, DebugLambdaInfo lambdaInfo) { _debugContext = debugContext; _lambdaInfo = lambdaInfo; _alias = _lambdaInfo.LambdaAlias; _debugContextExpression = AstUtils.Constant(debugContext); // Variables _verifiedLocals = new List <MSAst.ParameterExpression>(); _verifiedLocalNames = new Dictionary <string, object>(); _pendingLocals = new List <MSAst.ParameterExpression>(); _variableInfos = new List <VariableInfo>(); _pendingToVariableInfosMap = new Dictionary <MSAst.ParameterExpression, VariableInfo>(); _pendingToVerifiedLocalsMap = new Dictionary <MSAst.ParameterExpression, MSAst.ParameterExpression>(); // DebugMode expression that's used by the transformed code to see what the current debug mode is _globalDebugMode = Ast.Property(_debugContextExpression, "Mode"); }
internal void AddRule(Action <TContext> bindingAction, string key, DebugContext debugContext, bool runOnAttach, bool canOverride, IEnumerable <Expression> triggerExpressions) { if (_factory != null) { throw new InvalidOperationException("This binder already has attached watchers. It cannot be modified, but you can clone it and modify the clone instead."); } if (!string.IsNullOrEmpty(key) && canOverride) { RemoveRule(key); } _actions.Add(new BindingAction(bindingAction, key, debugContext, runOnAttach)); foreach (var expr in triggerExpressions) { new BindingExpressionVisitor <TContext>(_rootNode, typeof(TContext), _actions.Count - 1).Visit(expr); } }
public Contexts() { actor = new ActorContext(); config = new ConfigContext(); debug = new DebugContext(); game = new GameContext(); gameState = new GameStateContext(); input = new InputContext(); snapshot = new SnapshotContext(); var postConstructors = System.Linq.Enumerable.Where( GetType().GetMethods(), method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute)) ); foreach (var postConstructor in postConstructors) { postConstructor.Invoke(this, null); } }
internal DebugInfoRewriter( DebugContext debugContext, bool transformToGenerator, Expression traceLocations, Expression thread, Expression frame, Expression pushFrame, Expression debugMarker, Expression globalDebugMode, Dictionary <DebugSourceFile, ParameterExpression> sourceFilesToVariablesMap, LabelTarget generatorLabel, Dictionary <ParameterExpression, ParameterExpression> replacedLocals, Dictionary <ParameterExpression, VariableInfo> localsToVarInfos, DebugLambdaInfo lambdaInfo) { _debugContext = debugContext; _transformToGenerator = transformToGenerator; _traceLocations = traceLocations; _thread = thread; _frame = frame; _pushFrame = pushFrame; if (_transformToGenerator) { _debugYieldValue = Ast.Constant(DebugContext.DebugYieldValue); // When transforming to generator we'll also create marker-location and position-handler maps _markerLocationMap = new Dictionary <int, DebugSourceSpan>(); _variableScopeMap = new Dictionary <int, IList <VariableInfo> >(); _currentLocals = new Stack <BlockExpression>(); _variableScopeMapCache = new Dictionary <BlockExpression, IList <VariableInfo> >(); } _debugMarker = debugMarker; _globalDebugMode = globalDebugMode; _sourceFilesToVariablesMap = sourceFilesToVariablesMap; _generatorLabelTarget = generatorLabel; _replacedLocals = replacedLocals; _localsToVarInfos = localsToVarInfos; _lambdaInfo = lambdaInfo; }
private Payer Prepare_change_payer() { var payer = DataMother.CreatePayer(); payer.INN = "123321123"; session.Save(payer); payer.Name = "Тестовый плательщик " + payer.Id; FlushAndCommit(); DebugContext.Add("clientId", client.Id); DebugContext.Add("payerId", payer.Id); Css("#ChangePayer .term").TypeText(payer.Name); Css("#ChangePayer input[type=button].search").Click(); browser.WaitUntilContainsText(payer.Name, 1); var select = (SelectList)Css("select[name=payerId]"); Assert.That(select.SelectedItem, Is.EqualTo(String.Format("{0}, {1}", payer.Id, payer.Name))); return(payer); }
protected override void OnGUIMain() { NavmeshBuild build = Context.Build; if (!build) { return; } Rect statusArea = Context.MainArea; if (build.BuildState == NavmeshBuildState.Invalid) { return; } InputBuildInfo info; InputGeometry geometry = null; ConnectionSet connections = null; int triCount = 0; int processorCount = 0; ViewOption viewFlags = 0; bool hasData = false; string topLabel; if (mCompiler != null) { if (mCompiler.IsFinished) { if (mCompiler.HasData) { topLabel = "Input successfully compiled. (Needs to be accepted.)"; } else { topLabel = "No input data produced."; } } else { topLabel = "Compiling"; } info = mCompiler.Info; geometry = mCompiler.Geometry; connections = mCompiler.Connections; triCount = mCompiler.TriCount; processorCount = (mCompiler.Processors == null ? 0 : mCompiler.Processors.Length); if (geometry != null) { hasData = true; } } else if (build.HasInputData) { topLabel = "Current Input"; viewFlags = (ViewOption.Input | ViewOption.Grid); info = build.InputInfo; geometry = build.InputGeom; connections = build.Connections; triCount = geometry.TriCount; processorCount = build.NMGenProcessors.Count; hasData = true; } else { topLabel = "Input needs to be compiled."; info = new InputBuildInfo(); } DebugContext.SetViews(viewFlags); if (!hasData && triCount > 0) { GUI.Box(Context.MainArea , string.Format("{0} {1:N0} triangles", topLabel, triCount) , EditorUtil.HelpStyle); OnGUICompiler(statusArea); return; } GUILayout.BeginArea(statusArea, GUI.skin.box); string currScene = System.IO.Path.GetFileName(SceneManager.GetActiveScene().path); int idx = currScene.LastIndexOf("."); if (idx >= 0) { currScene = currScene.Substring(0, idx); } if (currScene.Length == 0) { currScene = "None"; } GUILayout.BeginHorizontal(); GUILayout.Label("Input scene:"); GUILayout.Label(" Current: " + currScene); GUILayout.Label(" Last: " + NavEditorUtil.SceneDisplayName(build.BuildTarget.BuildInfo)); GUILayout.EndHorizontal(); if (NavEditorUtil.SceneMismatch(build.BuildTarget.BuildInfo)) { GUILayout.Box("Current scene does not match last input scene." , EditorUtil.WarningStyle); } GUILayout.Space(MarginSize); GUILayout.Label(topLabel); if (hasData) { GUILayout.Space(ControlUtil.MarginSize * 3); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Geometry"); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label(string.Format("Triangles: {0:N0}", triCount)); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Min Bounds: " + Vector3Util.ToString(geometry.BoundsMin)); GUILayout.Label("Max Bounds: " + Vector3Util.ToString(geometry.BoundsMax)); GUILayout.Space(ControlUtil.MarginSize); UnityEngine.Vector3 diff = (geometry.BoundsMax - geometry.BoundsMin).ToUnityVector3(); GUILayout.Label(string.Format("WxHxD: {0:f3} x {1:f3} x {2:f3}" , diff.x, diff.y, diff.z)); GUILayout.Space(ControlUtil.MarginSize * 2); // Note: The build press interprets zero root objects as a global search. GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Components"); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Pre-filter: " + info.compCountPre); GUILayout.Label("Post-filter: " + info.compCountPost); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Modifiers"); GUILayout.Space(ControlUtil.MarginSize); GUILayout.Label("Component loaders: " + info.loaderCount); GUILayout.Label("Component filters: " + info.filterCount); GUILayout.Label("Area assignment: " + info.areaModifierCount); GUILayout.Label("Component compilers: " + info.compilerCount); GUILayout.Label("Input post-processors: " + info.postCount); GUILayout.Label("NMGen processors: " + processorCount); GUILayout.Label("Off-Mesh connections: " + connections.Count); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.EndArea(); OnGUICompiler(statusArea); }
internal DefaultDebugThread(DebugContext debugContext) : base(debugContext) { _frames = new List <FrameRuntimeVariablesPair>(); }