From 8c4773f75b06851586209f810ac1f8c759bf072f Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 15 Jul 2012 15:45:39 -0400 Subject: [PATCH] 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. --- .../value/value_nodes/CStringValueNode.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/apps/debugger/value/value_nodes/CStringValueNode.cpp b/src/apps/debugger/value/value_nodes/CStringValueNode.cpp index dc967113b4..3b5f90ce9d 100644 --- a/src/apps/debugger/value/value_nodes/CStringValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/CStringValueNode.cpp @@ -73,14 +73,24 @@ CStringValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, if (dynamic_cast(fType) != NULL) { error = valueLoader->LoadValue(location, valueType, false, addressData); + if (error != B_OK) + return error; } else { addressData.SetTo(location->PieceAt(0).address); maxSize = dynamic_cast(fType) ->DimensionAt(0)->CountElements(); } - if (error != B_OK) - return error; + ValuePieceLocation piece; + piece.SetToMemory(addressData.ToUInt64()); + + ValueLocation* stringLocation = new(std::nothrow) ValueLocation( + valueLoader->GetArchitecture()->IsBigEndian(), piece); + + if (stringLocation == NULL) + return B_NO_MEMORY; + + BReference locationReference(stringLocation, true); error = valueLoader->LoadStringValue(addressData, maxSize, valueData); if (error != B_OK) @@ -91,8 +101,8 @@ CStringValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, if (value == NULL) return B_NO_MEMORY; - location->AcquireReference(); - _location = location; + NodeChild()->SetLocation(stringLocation, B_OK); + _location = locationReference.Detach(); _value = value; return B_OK; }