public DebugManager(SlaveContext context) { _context = context; _watchDatas = new DebugWatchData(); _breakPoints = new Dictionary <string, StepTaskEntityBase>(Constants.DefaultRuntimeSize); _hitBreakPoints = new Dictionary <int, StepTaskEntityBase>(20); _hitBreakPointsLock = new ReaderWriterLockSlim(); }
public static IDictionary <IVariable, string> GetVariableValues(DebugWatchData debugWatchData, ISequenceFlowContainer sequenceData) { Dictionary <IVariable, string> variableValues = new Dictionary <IVariable, string>(debugWatchData.Count); for (int i = 0; i < debugWatchData.Count; i++) { IVariable variable = GetVariable(sequenceData, debugWatchData.Names[i]); variableValues.Add(variable, debugWatchData.Values[i]); } return(variableValues); }
private void RefreshWatchData(DebugMessage message) { if (message.WatchData?.Names != null) { _watchDatas = message.WatchData; _hitBreakPointsLock.EnterReadLock(); try { // 如果存在Coroutine被阻塞,则在所有的断点上发送DebugMessage以更新当前节点的值 if (_hitBreakPoints.Count > 0) { _watchDatas.Values.Clear(); foreach (string watchData in _watchDatas.Names) { string variableName = ModuleUtils.GetVariableNameFromParamValue(watchData); _watchDatas.Values.Add(_context.VariableMapper.GetWatchDataValue(variableName, watchData)); } foreach (StepTaskEntityBase blockStep in _hitBreakPoints.Values) { if (null == blockStep) { continue; } CallStack breakPoint = blockStep.GetStack(); DebugMessage debugMessage = new DebugMessage(MessageNames.BreakPointHitName, _context.SessionId, breakPoint, false) { WatchData = _watchDatas }; _context.MessageTransceiver.SendMessage(debugMessage); } _context.LogSession.Print(LogLevel.Debug, _context.SessionId, "Refresh Watch data values."); } } finally { _hitBreakPointsLock.ExitReadLock(); } } else { _watchDatas.Names.Clear(); _watchDatas.Values.Clear(); } }