internal void RegisterPgm(GXDebugInfo parentDbgInfo) { GXDebugManager.Instance.PushPgm(this, parentDbgInfo != null ? parentDbgInfo.SId : GXDebugManager.PGM_INFO_NO_PARENT, Key); if (parentDbgInfo != null) { parentDbgInfo.UpdateTicks(); parentDbgInfo.LastItem = null; parentDbgInfo.stopwatch.Restart(); } }
internal GXDebugItem PushRange(GXDebugInfo dbgInfo, int lineNro, int colNro, int lineNro2, int colNro2) { if ((colNro != 0 || colNro2 != 0)) { return(mPush(dbgInfo, GXDebugMsgType.PGM_TRACE_RANGE_WITH_COLS, lineNro, lineNro2, new KeyValuePair <int, int>(colNro, colNro2))); } else { return(mPush(dbgInfo, GXDebugMsgType.PGM_TRACE_RANGE, lineNro, lineNro2, null)); } }
internal void OnCleanup(GXDebugInfo dbgInfo) { PushSystem((int)GXDebugMsgCode.OBJ_CLEANUP, dbgInfo.SId); lock (sessionLock) { if (dbgInfo.Parent != null) { parentTable[dbgInfo.context.ClientID] = dbgInfo.Parent; } else { parentTable.TryRemove(dbgInfo.context.ClientID, out GXDebugInfo oldParent); if (!GxContext.Current.IsStandalone) { Save(); } } } }
internal GXDebugInfo GetDbgInfo(IGxContext context, int objClass, int objId, int dbgLines, long hash) { lock (sessionLock) { GXDebugInfo dbgInfo = new GXDebugInfo(NewSId(), context, new KeyValuePair <int, int>(objClass, objId)); if (!pgmInfoTable.Contains(dbgInfo.Key)) { KeyValuePair <int, long> pgmInfoObj = new KeyValuePair <int, long>(dbgLines, hash); pgmInfoTable.Add(dbgInfo.Key); PushSystem(GXDebugMsgCode.PGM_INFO.ToByte(), new KeyValuePair <object, object>(dbgInfo.Key, pgmInfoObj)); } if (parentTable.TryGetValue(context.ClientID, out GXDebugInfo parentDbgInfo)) { dbgInfo.Parent = parentDbgInfo; } dbgInfo.RegisterPgm(parentDbgInfo); parentTable[context.ClientID] = dbgInfo; return(dbgInfo); } }
internal void OnExit(GXDebugInfo dbgInfo) { PushSystem((int)GXDebugMsgCode.EXIT); Save(); }
private GXDebugItem mPush(GXDebugInfo dbgInfo, GXDebugMsgType msgType, int arg1, int arg2, object argObj = null) { lock (saveLock) { if (ToSave != null) { Save(ToSave); ToSave = null; } GXDebugItem currentItem = Current[dbgIndex]; currentItem.DbgInfo = dbgInfo; currentItem.MsgType = msgType; currentItem.Arg1 = arg1; currentItem.Arg2 = arg2; currentItem.ArgObj = argObj; switch (msgType) { case GXDebugMsgType.SYSTEM: { switch ((GXDebugMsgCode)arg1) { case GXDebugMsgCode.INITIALIZE: case GXDebugMsgCode.EXIT: case GXDebugMsgCode.OBJ_CLEANUP: case GXDebugMsgCode.PGM_INFO: currentItem.Ticks = TICKS_NOT_NEEDED; break; default: currentItem.Ticks = TICKS_NOT_SET; break; } } break; case GXDebugMsgType.REGISTER_PGM: { currentItem.Ticks = TICKS_NOT_NEEDED; } break; default: currentItem.Ticks = TICKS_NOT_SET; break; } dbgIndex++; if (dbgIndex == Current.Length) { bool mSaving = false; lock (mSaveLock) { mSaving = saving; } if (mSaving) { waitSaveEvent.WaitOne(); } ToSave = Current; GXDebugItem[] swap = Current; Current = Next; Next = swap; pgmInfoTable.Clear(); dbgIndex = 0; } return(currentItem); } }
internal GXDebugItem PushPgm(GXDebugInfo dbgInfo, int ParentSId, KeyValuePair <int, int> PgmKey) => mPush(dbgInfo, GXDebugMsgType.REGISTER_PGM, ParentSId, 0, PgmKey);
internal GXDebugItem Push(GXDebugInfo dbgInfo, int lineNro, int colNro = 0) => mPush(dbgInfo, GXDebugMsgType.PGM_TRACE, lineNro, colNro, null);