[haiku-commits] r42370 - in haiku/trunk/src/apps/debugger/value: type_handlers value_nodes

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 4 Jul 2011 14:44:29 +0200 (CEST)

Author: anevilyak
Date: 2011-07-04 14:44:29 +0200 (Mon, 04 Jul 2011)
New Revision: 42370
Changeset: https://dev.haiku-os.org/changeset/42370

Modified:
   haiku/trunk/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp
   haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp
   haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.h
Log:
Simplification due to better understanding of the node system.



Modified: 
haiku/trunk/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp   
2011-07-04 12:41:58 UTC (rev 42369)
+++ haiku/trunk/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp   
2011-07-04 12:44:29 UTC (rev 42370)
@@ -20,29 +20,8 @@
 float
 BMessageTypeHandler::SupportsType(Type* type)
 {
-       AddressType* addressType = dynamic_cast<AddressType*>(type);
-       CompoundType* baseType = dynamic_cast<CompoundType*>(type);
-       ModifiedType* modifiedType = NULL;
-       if (addressType != NULL && addressType->AddressKind()
-               == DERIVED_TYPE_POINTER) {
-                       baseType = dynamic_cast<CompoundType*>(
-                               addressType->BaseType());
-               if (baseType == NULL) {
-                       modifiedType = dynamic_cast<ModifiedType*>(
-                               addressType->BaseType());
-               }
-       }
-
-       if (baseType == NULL && modifiedType == NULL)
-               return 0.0f;
-       else if (modifiedType != NULL) {
-               baseType = dynamic_cast<CompoundType*>(
-                       modifiedType->ResolveRawType(false));
-               if (baseType == NULL)
-                       return 0.0f;
-       }
-
-       if (baseType->ResolveRawType(true)->Name() == "BMessage")
+       if (dynamic_cast<CompoundType*>(type) != NULL
+               && type->Name() == "BMessage")
                return 1.0f;
 
        return 0.0f;

Modified: haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp       
2011-07-04 12:41:58 UTC (rev 42369)
+++ haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp       
2011-07-04 12:44:29 UTC (rev 42370)
@@ -65,7 +65,7 @@
        {
                ValueLocation* parentLocation = fParent->Location();
                ValueLocation* location;
-               CompoundType* type = fParent->GetMessageType();
+               CompoundType* type = 
dynamic_cast<CompoundType*>(fParent->GetType());
 
                status_t error = type->ResolveDataMemberLocation(fMember,
                        *parentLocation, location);
@@ -92,7 +92,6 @@
        :
        ValueNode(nodeChild),
        fType(type),
-       fMessageType(NULL),
        fLoader(NULL),
        fHeader(NULL),
        fFields(NULL),
@@ -131,7 +130,6 @@
        if (location == NULL)
                return B_BAD_VALUE;
 
-       TRACE_LOCALS("  TYPE_ADDRESS (BMessage)\n");
 
        // get the value type
        type_code valueType;
@@ -146,24 +144,6 @@
        // load the value data
 
        status_t error = B_OK;
-       CompoundType* baseType = dynamic_cast<CompoundType*>(
-               fType->ResolveRawType(false));
-       AddressType* addressType = dynamic_cast<AddressType*>(fType);
-       if (addressType != NULL) {
-               BVariant address;
-               baseType = dynamic_cast<CompoundType*>(addressType->BaseType()
-                       ->ResolveRawType(false));
-               error = valueLoader->LoadValue(location, valueType, false,
-                       address);
-               if (error != B_OK)
-                       return error;
-
-               ValuePieceLocation pieceLocation;
-               pieceLocation.SetToMemory(address.ToUInt64());
-               location->SetPieceAt(0, pieceLocation);
-       }
-       fMessageType = baseType;
-
        _location = location;
        _value = NULL;
 
@@ -173,6 +153,8 @@
        BVariant fieldAddress;
        BVariant what;
 
+       CompoundType* baseType = dynamic_cast<CompoundType*>(fType);
+
        for (int32 i = 0; i < baseType->CountDataMembers(); i++) {
                DataMember* member = baseType->DataMemberAt(i);
                if (strcmp(member->Name(), "fHeader") == 0) {
@@ -313,14 +295,12 @@
        if (!fChildren.IsEmpty())
                return B_OK;
 
-       if (fMessageType == NULL)
-               return B_BAD_VALUE;
-
        DataMember* member = NULL;
        Type* whatType = NULL;
 
-       for (int32 i = 0; i < fMessageType->CountDataMembers(); i++) {
-               member = fMessageType->DataMemberAt(i);
+       CompoundType* messageType = dynamic_cast<CompoundType*>(fType);
+       for (int32 i = 0; i < messageType->CountDataMembers(); i++) {
+               member = messageType->DataMemberAt(i);
                if (strcmp(member->Name(), "what") == 0) {
                        whatType = member->GetType();
                        break;
@@ -346,8 +326,9 @@
                _GetTypeForTypeCode(type, fieldType);
 
                BMessageFieldNodeChild* node = new(std::nothrow)
-                       BMessageFieldNodeChild(this, fieldType != NULL ? 
fieldType : fType,
-                       name, type, count);
+                       BMessageFieldNodeChild(this,
+                               fieldType != NULL ? fieldType : fType, name, 
type,
+                               count);
                if (node == NULL)
                        return B_NO_MEMORY;
 
@@ -589,7 +570,7 @@
        :
        ValueNode(child),
        fName(name),
-       fType(parent->fMessageType),
+       fType(parent->GetType()),
        fParent(parent),
        fFieldType(type),
        fFieldCount(count)
@@ -694,7 +675,7 @@
 bool
 BMessageValueNode::BMessageFieldNodeChild::IsInternal() const
 {
-       return fFieldCount > 1;
+       return false;
 }
 
 

Modified: haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.h
===================================================================
--- haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.h 
2011-07-04 12:41:58 UTC (rev 42369)
+++ haiku/trunk/src/apps/debugger/value/value_nodes/BMessageValueNode.h 
2011-07-04 12:44:29 UTC (rev 42370)
@@ -35,9 +35,6 @@
        virtual int32                                   CountChildren() const;
        virtual ValueNodeChild*                 ChildAt(int32 index) const;
 
-                       CompoundType*                   GetMessageType() const
-                                                                               
{ return fMessageType; }
-
 private:
                        status_t                                
_GetTypeForTypeCode(type_code type,
                                                                                
Type*& _type);
@@ -61,7 +58,6 @@
 
 private:
                        Type*                                   fType;
-                       CompoundType*                   fMessageType;
                        ChildNodeList                   fChildren;
                        ValueLoader*                    fLoader;
                        BVariant                                fDataLocation;


Other related posts:

  • » [haiku-commits] r42370 - in haiku/trunk/src/apps/debugger/value: type_handlers value_nodes - anevilyak