public override LiveWatchNodeState UpdateState(LiveWatchUpdateContext context) { var result = new LiveWatchNodeState { Icon = LiveWatchNodeIcon.Thread }; if (context.PreloadChildren) { result.NewChildren = _Root.RefreshThreadList(); } return(result); }
public override LiveWatchNodeState UpdateState(LiveWatchUpdateContext context) { var result = new LiveWatchNodeState { Icon = LiveWatchNodeIcon.Queue }; if (context.PreloadChildren) { if (_Children == null) { _Children = _Root.GetAllQueues(); } result.NewChildren = _Children; } return(result); }
public override LiveWatchNodeState UpdateState(LiveWatchUpdateContext context) { var result = new LiveWatchNodeState { Icon = LiveWatchNodeIcon.Graph }; if (_xSchedulerRunning != null) { if (_xSchedulerRunning.GetValue().ToUlong() != 0) { result.Value = "active"; } else { result.Value = "inactive"; } } return(result); }
public override LiveWatchNodeState UpdateState(LiveWatchUpdateContext context) { if (_PointerVariable != null) { var address = _PointerVariable.GetValue().ToUlong() & ~1UL; if (address != _QueueVariable?.Address) { _QueueVariable = _Engine.Symbols.CreateTypedVariable(address, _QueueType); } } if (_QueueVariable != null && _QueueVariable.Address != _Variables.LastKnownAddress) { _Variables.LastKnownAddress = _QueueVariable.Address; //The previous instance will get auto-disposed by VisualGDB. _QueueObjectNode = null; _Variables.Reset(); if (_QueueVariable.Address != 0) { _Variables.uxMessagesWaiting = _Engine.CreateLiveVariable(_QueueVariable.LookupSpecificChild(nameof(_Variables.uxMessagesWaiting))); _Variables.uxLength = _Engine.CreateLiveVariable(_QueueVariable.LookupSpecificChild(nameof(_Variables.uxLength))); _Variables.u_xSemaphore_xMutexHolder = _Engine.CreateLiveVariable(_QueueVariable.LookupChildRecursively("u.xSemaphore.xMutexHolder")); _Variables.u_xSemaphore_uxRecursiveCallCount = _Engine.CreateLiveVariable(_QueueVariable.LookupChildRecursively("u.xSemaphore.uxRecursiveCallCount")); } } if (context.PreloadChildren && _QueueVariable != null && _QueueObjectNode == null && _QueueVariable.Address != 0) { _QueueObjectNode = _Engine.CreateNodeForPinnedVariable(_QueueVariable, new LiveWatchNodeOverrides { Name = "[Object]" }); } var result = new LiveWatchNodeState(); if ((_QueueVariable?.Address ?? 0) == 0) { result.Value = "[NULL]"; } else if (_Variables.uxLength == null || _Variables.uxMessagesWaiting == null) { result.Value = "???"; } else { if (_Descriptor.TypeOverride != null && !_StaticType.HasValue) { var typeVar = _QueueVariable.LookupSpecificChild("ucQueueType"); if (typeVar != null) { _StaticType = (QueueType)_Engine.ReadMemory(typeVar).ToUlong(); RawType = _StaticType.Value.ToString(); } } var detectedType = _StaticType ?? _Descriptor.Type; var rawValue = _Variables.uxMessagesWaiting.GetValue(); int value = (int)rawValue.ToUlong(); int maxValue = (int)_Variables.uxLength.GetValue().ToUlong(); ulong owner = 0, level = 0; if (detectedType != QueueType.BaseQueue && _Variables.u_xSemaphore_xMutexHolder != null && _Variables.u_xSemaphore_uxRecursiveCallCount != null) { owner = _Variables.u_xSemaphore_xMutexHolder.GetValue().ToUlong(); level = _Variables.u_xSemaphore_uxRecursiveCallCount.GetValue().ToUlong(); if (owner == _QueueVariable.Address) { detectedType = QueueType.Semaphore; } else { detectedType = QueueType.RecursiveMutex; } } if (detectedType == QueueType.RecursiveMutex || detectedType == QueueType.NonRecursiveMutex) { if (value != 0) { result.Value = "free"; RawValue = new LiveVariableValue(rawValue.Timestamp, rawValue.Generation, BitConverter.GetBytes(0)); } else if (_Variables.u_xSemaphore_xMutexHolder != null && _Variables.u_xSemaphore_uxRecursiveCallCount != null) { string threadName = _Root.GetThreadName(owner); result.Value = $"taken by {threadName}"; if (level >= 1) { result.Value += $" (recursion = {level})"; } RawValue = new LiveVariableValue(rawValue.Timestamp, rawValue.Generation, BitConverter.GetBytes((int)level + 1)); } else { result.Value = "taken"; } } else { RawValue = rawValue; result.Value = $"{value}/{maxValue}"; } result.NewType = detectedType.ToString(); switch (detectedType) { case QueueType.BinarySemaphore: case QueueType.Semaphore: case QueueType.RecursiveMutex: case QueueType.NonRecursiveMutex: result.Icon = LiveWatchNodeIcon.Flag; break; case QueueType.BaseQueue: result.Icon = LiveWatchNodeIcon.Queue; break; } if (context.PreloadChildren) { ProvideWaitingThreadsNodes(detectedType); result.NewChildren = new[] { _ReadThreadQueue, _WriteThreadQueue, _QueueObjectNode }.Where(n => n != null).ToArray(); } } return(result); }