From 8a7985745ccdebb615d9b613777ac5b6aff1a9d9 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 1 Jul 2011 01:54:58 +0000 Subject: [PATCH] Cleanups to simplify handling of pointer vs value types. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42353 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../value/value_nodes/BMessageValueNode.cpp | 17 ++++++++--------- .../value/value_nodes/BMessageValueNode.h | 8 +++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp index 132dcca5e5..26d3c38744 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp @@ -64,9 +64,7 @@ public: { ValueLocation* parentLocation = fParent->Location(); ValueLocation* location; - CompoundType* type = dynamic_cast(fParent->GetType()); - if (type == NULL) - return B_BAD_VALUE; + CompoundType* type = fParent->GetMessageType(); status_t error = type->ResolveDataMemberLocation(fMember, *parentLocation, location); @@ -93,6 +91,7 @@ BMessageValueNode::BMessageValueNode(ValueNodeChild* nodeChild, : ValueNode(nodeChild), fType(type), + fMessageType(NULL), fMessage() { fType->AcquireReference(); @@ -154,6 +153,7 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, pieceLocation.SetToMemory(address.ToUInt64()); location->SetPieceAt(0, pieceLocation); } + fMessageType = baseType; _location = location; _value = NULL; @@ -300,16 +300,15 @@ BMessageValueNode::CreateChildren() if (!fChildren.IsEmpty()) return B_OK; - CompoundType* baseType = dynamic_cast( - fType->ResolveRawType(false)); - if (baseType == NULL) - return B_OK; + if (fMessageType == NULL) + return B_BAD_VALUE; + DataMember* member = NULL; Type* whatType = NULL; - for (int32 i = 0; i < baseType->CountDataMembers(); i++) { - member = baseType->DataMemberAt(i); + for (int32 i = 0; i < fMessageType->CountDataMembers(); i++) { + member = fMessageType->DataMemberAt(i); if (strcmp(member->Name(), "what") == 0) { whatType = member->GetType(); break; diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.h b/src/apps/debugger/value/value_nodes/BMessageValueNode.h index c648bb2e2e..7ae2224d59 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.h +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.h @@ -11,6 +11,9 @@ #include "ValueNode.h" +class CompoundType; + + class BMessageValueNode : public ValueNode { public: BMessageValueNode(ValueNodeChild* nodeChild, @@ -18,7 +21,6 @@ public: virtual ~BMessageValueNode(); virtual Type* GetType() const; - virtual status_t ResolvedLocationAndValue( ValueLoader* valueLoader, ValueLocation*& _location, @@ -30,6 +32,9 @@ public: virtual int32 CountChildren() const; virtual ValueNodeChild* ChildAt(int32 index) const; + CompoundType* GetMessageType() const + { return fMessageType; } + private: class BMessageFieldHeaderNode; class BMessageFieldHeaderNodeChild; @@ -42,6 +47,7 @@ private: private: Type* fType; + CompoundType* fMessageType; BMessage fMessage; ChildNodeList fChildren; };