From 140b05c8ecc3c835ee17171ed3fb179063c10b98 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 4 Jul 2011 12:44:29 +0000 Subject: [PATCH] Simplification due to better understanding of the node system. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42370 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../type_handlers/BMessageTypeHandler.cpp | 25 +---------- .../value/value_nodes/BMessageValueNode.cpp | 41 +++++-------------- .../value/value_nodes/BMessageValueNode.h | 4 -- 3 files changed, 13 insertions(+), 57 deletions(-) diff --git a/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp b/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp index d29605d32a..a46fcbbbee 100644 --- a/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp +++ b/src/apps/debugger/value/type_handlers/BMessageTypeHandler.cpp @@ -20,29 +20,8 @@ BMessageTypeHandler::~BMessageTypeHandler() float BMessageTypeHandler::SupportsType(Type* type) { - AddressType* addressType = dynamic_cast(type); - CompoundType* baseType = dynamic_cast(type); - ModifiedType* modifiedType = NULL; - if (addressType != NULL && addressType->AddressKind() - == DERIVED_TYPE_POINTER) { - baseType = dynamic_cast( - addressType->BaseType()); - if (baseType == NULL) { - modifiedType = dynamic_cast( - addressType->BaseType()); - } - } - - if (baseType == NULL && modifiedType == NULL) - return 0.0f; - else if (modifiedType != NULL) { - baseType = dynamic_cast( - modifiedType->ResolveRawType(false)); - if (baseType == NULL) - return 0.0f; - } - - if (baseType->ResolveRawType(true)->Name() == "BMessage") + if (dynamic_cast(type) != NULL + && type->Name() == "BMessage") return 1.0f; return 0.0f; diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp index 65124cae7f..6c6f0ced27 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp @@ -65,7 +65,7 @@ public: { ValueLocation* parentLocation = fParent->Location(); ValueLocation* location; - CompoundType* type = fParent->GetMessageType(); + CompoundType* type = dynamic_cast(fParent->GetType()); status_t error = type->ResolveDataMemberLocation(fMember, *parentLocation, location); @@ -92,7 +92,6 @@ BMessageValueNode::BMessageValueNode(ValueNodeChild* nodeChild, : ValueNode(nodeChild), fType(type), - fMessageType(NULL), fLoader(NULL), fHeader(NULL), fFields(NULL), @@ -131,7 +130,6 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, if (location == NULL) return B_BAD_VALUE; - TRACE_LOCALS(" TYPE_ADDRESS (BMessage)\n"); // get the value type type_code valueType; @@ -146,24 +144,6 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, // load the value data status_t error = B_OK; - CompoundType* baseType = dynamic_cast( - fType->ResolveRawType(false)); - AddressType* addressType = dynamic_cast(fType); - if (addressType != NULL) { - BVariant address; - baseType = dynamic_cast(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 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, BVariant fieldAddress; BVariant what; + CompoundType* baseType = dynamic_cast(fType); + for (int32 i = 0; i < baseType->CountDataMembers(); i++) { DataMember* member = baseType->DataMemberAt(i); if (strcmp(member->Name(), "fHeader") == 0) { @@ -313,14 +295,12 @@ BMessageValueNode::CreateChildren() 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(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 @@ BMessageValueNode::CreateChildren() _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 @@ BMessageValueNode::BMessageFieldNode::BMessageFieldNode( : ValueNode(child), fName(name), - fType(parent->fMessageType), + fType(parent->GetType()), fParent(parent), fFieldType(type), fFieldCount(count) @@ -694,7 +675,7 @@ BMessageValueNode::BMessageFieldNodeChild::Parent() const bool BMessageValueNode::BMessageFieldNodeChild::IsInternal() const { - return fFieldCount > 1; + return false; } diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.h b/src/apps/debugger/value/value_nodes/BMessageValueNode.h index 9fca6cce07..97f42d2833 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.h +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.h @@ -35,9 +35,6 @@ public: 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: private: Type* fType; - CompoundType* fMessageType; ChildNodeList fChildren; ValueLoader* fLoader; BVariant fDataLocation;