Adjust address semantics of CStringValueNode.

- When resolving its value, CStringValueNode now sets its node child's
  address to the address of the string buffer rather than the location of
  the originating pointer, which allows things like Inspect to pick that up.
This commit is contained in:
Rene Gollent
2012-07-15 15:48:07 -04:00
parent 4bb5af765f
commit 8c4773f75b
@@ -73,14 +73,24 @@ CStringValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
if (dynamic_cast<AddressType*>(fType) != NULL) { if (dynamic_cast<AddressType*>(fType) != NULL) {
error = valueLoader->LoadValue(location, valueType, false, error = valueLoader->LoadValue(location, valueType, false,
addressData); addressData);
if (error != B_OK)
return error;
} else { } else {
addressData.SetTo(location->PieceAt(0).address); addressData.SetTo(location->PieceAt(0).address);
maxSize = dynamic_cast<ArrayType*>(fType) maxSize = dynamic_cast<ArrayType*>(fType)
->DimensionAt(0)->CountElements(); ->DimensionAt(0)->CountElements();
} }
if (error != B_OK) ValuePieceLocation piece;
return error; piece.SetToMemory(addressData.ToUInt64());
ValueLocation* stringLocation = new(std::nothrow) ValueLocation(
valueLoader->GetArchitecture()->IsBigEndian(), piece);
if (stringLocation == NULL)
return B_NO_MEMORY;
BReference<ValueLocation> locationReference(stringLocation, true);
error = valueLoader->LoadStringValue(addressData, maxSize, valueData); error = valueLoader->LoadStringValue(addressData, maxSize, valueData);
if (error != B_OK) if (error != B_OK)
@@ -91,8 +101,8 @@ CStringValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
if (value == NULL) if (value == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
location->AcquireReference(); NodeChild()->SetLocation(stringLocation, B_OK);
_location = location; _location = locationReference.Detach();
_value = value; _value = value;
return B_OK; return B_OK;
} }