status_t AbstractArrayValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, ValueLocation*& _location, Value*& _value) { // get the location ValueLocation* location = NodeChild()->Location(); if (location == NULL) return B_BAD_VALUE; location->AcquireReference(); _location = location; _value = NULL; return B_OK; }
status_t BListValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, ValueLocation*& _location, Value*& _value) { // get the location ValueLocation* location = NodeChild()->Location(); if (location == NULL) return B_BAD_VALUE; // get the value type type_code valueType; if (valueLoader->GetArchitecture()->AddressSize() == 4) { valueType = B_UINT32_TYPE; TRACE_LOCALS(" -> 32 bit\n"); } else { valueType = B_UINT64_TYPE; TRACE_LOCALS(" -> 64 bit\n"); } // load the value data status_t error = B_OK; _location = location; _value = NULL; ValueLocation* memberLocation = NULL; CompoundType* baseType = dynamic_cast<CompoundType*>(fType); if (baseType->CountTemplateParameters() != 0) { // for BObjectList we need to walk up // the hierarchy: BObjectList -> _PointerList_ -> BList if (baseType->CountBaseTypes() == 0) return B_BAD_DATA; baseType = dynamic_cast<CompoundType*>(baseType->BaseTypeAt(0) ->GetType()); if (baseType == NULL || baseType->Name() != "_PointerList_") return B_BAD_DATA; if (baseType->CountBaseTypes() == 0) return B_BAD_DATA; baseType = dynamic_cast<CompoundType*>(baseType->BaseTypeAt(0) ->GetType()); if (baseType == NULL || baseType->Name() != "BList") return B_BAD_DATA; } for (int32 i = 0; i < baseType->CountDataMembers(); i++) { DataMember* member = baseType->DataMemberAt(i); if (strcmp(member->Name(), "fObjectList") == 0) { error = baseType->ResolveDataMemberLocation(member, *location, memberLocation); BReference<ValueLocation> locationRef(memberLocation, true); if (error != B_OK) { TRACE_LOCALS( "BListValueNode::ResolvedLocationAndValue(): " "failed to resolve location of header member: %s\n", strerror(error)); return error; } error = valueLoader->LoadValue(memberLocation, valueType, false, fDataLocation); if (error != B_OK) return error; } else if (strcmp(member->Name(), "fItemCount") == 0) { error = baseType->ResolveDataMemberLocation(member, *location, memberLocation); BReference<ValueLocation> locationRef(memberLocation, true); if (error != B_OK) { TRACE_LOCALS( "BListValueNode::ResolvedLocationAndValue(): " "failed to resolve location of header member: %s\n", strerror(error)); return error; } fItemCountType = member->GetType(); fItemCountType->AcquireReference(); fItemCountLocation = memberLocation->PieceAt(0).address; BVariant listSize; error = valueLoader->LoadValue(memberLocation, valueType, false, listSize); if (error != B_OK) return error; fItemCount = listSize.ToInt32(); TRACE_LOCALS( "BListValueNode::ResolvedLocationAndValue(): " "detected list size %" B_PRId32 "\n", fItemCount); } memberLocation = NULL; } return B_OK; }