void VariablesView::_RequestNodeValue(ModelNode* node) { // get the node child and its container ValueNodeChild* nodeChild = node->NodeChild(); ValueNodeContainer* container = nodeChild->Container(); BReference<ValueNodeContainer> containerReference(container); AutoLocker<ValueNodeContainer> containerLocker(container); if (container == NULL || nodeChild->Container() != container) return; // get the value node and check whether its value has not yet been resolved ValueNode* valueNode = nodeChild->Node(); if (valueNode == NULL || valueNode->LocationAndValueResolutionState() != VALUE_NODE_UNRESOLVED) { return; } BReference<ValueNode> valueNodeReference(valueNode); containerLocker.Unlock(); // request resolution of the value fListener->ValueNodeValueRequested(fStackFrame->GetCpuState(), container, valueNode); }
status_t ResolveValueNodeValueJob::_ResolveNodeValue() { // get the node child and parent node AutoLocker<ValueNodeContainer> containerLocker(fContainer); ValueNodeChild* nodeChild = fValueNode->NodeChild(); BReference<ValueNodeChild> nodeChildReference(nodeChild); ValueNode* parentNode = nodeChild->Parent(); BReference<ValueNode> parentNodeReference(parentNode); // Check whether the node child location has been resolved already // (successfully). status_t nodeChildResolutionState = nodeChild->LocationResolutionState(); bool nodeChildDone = nodeChildResolutionState != VALUE_NODE_UNRESOLVED; if (nodeChildDone && nodeChildResolutionState != B_OK) return nodeChildResolutionState; // If the child node location has not been resolved yet, check whether the // parent node location and value have been resolved already (successfully). bool parentDone = true; if (!nodeChildDone && parentNode != NULL) { status_t parentResolutionState = parentNode->LocationAndValueResolutionState(); parentDone = parentResolutionState != VALUE_NODE_UNRESOLVED; if (parentDone && parentResolutionState != B_OK) return parentResolutionState; } containerLocker.Unlock(); // resolve the parent node location and value, if necessary if (!parentDone) { status_t error = _ResolveParentNodeValue(parentNode); if (error != B_OK) { TRACE_LOCALS("ResolveValueNodeValueJob::_ResolveNodeValue(): value " "node: %p (\"%s\"): _ResolveParentNodeValue(%p) failed\n", fValueNode, fValueNode->Name().String(), parentNode); return error; } } // resolve the node child location, if necessary if (!nodeChildDone) { status_t error = _ResolveNodeChildLocation(nodeChild); if (error != B_OK) { TRACE_LOCALS("ResolveValueNodeValueJob::_ResolveNodeValue(): value " "node: %p (\"%s\"): _ResolveNodeChildLocation(%p) failed\n", fValueNode, fValueNode->Name().String(), nodeChild); return error; } } // resolve the node location and value ValueLoader valueLoader(fArchitecture, fDebuggerInterface, fTypeInformation, fCpuState); ValueLocation* location; Value* value; status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader, location, value); if (error != B_OK) { TRACE_LOCALS("ResolveValueNodeValueJob::_ResolveNodeValue(): value " "node: %p (\"%s\"): fValueNode->ResolvedLocationAndValue() " "failed\n", fValueNode, fValueNode->Name().String()); return error; } BReference<ValueLocation> locationReference(location, true); BReference<Value> valueReference(value, true); // set location and value on the node containerLocker.Lock(); status_t nodeResolutionState = fValueNode->LocationAndValueResolutionState(); if (nodeResolutionState != VALUE_NODE_UNRESOLVED) return nodeResolutionState; fValueNode->SetLocationAndValue(location, value, B_OK); containerLocker.Unlock(); return B_OK; }