[haiku-commits] haiku: hrev44344 - src/apps/debugger/value/value_nodes

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 15 Jul 2012 21:48:22 +0200 (CEST)

hrev44344 adds 1 changeset to branch 'master'
old head: 4bb5af765fc7c9e4daf911d5ad8db763403fdd21
new head: 8c4773f75b06851586209f810ac1f8c759bf072f

----------------------------------------------------------------------------

8c4773f: 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.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44344
Commit:      8c4773f75b06851586209f810ac1f8c759bf072f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8c4773f
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sun Jul 15 19:45:39 2012 UTC

----------------------------------------------------------------------------

1 file changed, 14 insertions(+), 4 deletions(-)
.../value/value_nodes/CStringValueNode.cpp         |   18 ++++++++++++----

----------------------------------------------------------------------------

diff --git a/src/apps/debugger/value/value_nodes/CStringValueNode.cpp 
b/src/apps/debugger/value/value_nodes/CStringValueNode.cpp
index dc96711..3b5f90c 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<AddressType*>(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<ArrayType*>(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<ValueLocation> 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;
 }


Other related posts:

  • » [haiku-commits] haiku: hrev44344 - src/apps/debugger/value/value_nodes - anevilyak