1 //===-- ValueObjectDynamicValue.h -----------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_ValueObjectDynamicValue_h_ 11 #define liblldb_ValueObjectDynamicValue_h_ 12 13 // C Includes 14 // C++ Includes 15 // Other libraries and framework includes 16 // Project includes 17 #include "lldb/Core/ValueObject.h" 18 #include "lldb/Symbol/Type.h" 19 20 namespace lldb_private { 21 22 //---------------------------------------------------------------------- 23 // A ValueObject that represents memory at a given address, viewed as some 24 // set lldb type. 25 //---------------------------------------------------------------------- 26 class ValueObjectDynamicValue : public ValueObject 27 { 28 public: 29 virtual 30 ~ValueObjectDynamicValue(); 31 32 virtual uint64_t 33 GetByteSize(); 34 35 virtual ConstString 36 GetTypeName(); 37 38 virtual ConstString 39 GetQualifiedTypeName(); 40 41 virtual size_t 42 CalculateNumChildren(); 43 44 virtual lldb::ValueType 45 GetValueType() const; 46 47 virtual bool 48 IsInScope (); 49 50 virtual bool IsDynamic()51 IsDynamic () 52 { 53 return true; 54 } 55 56 virtual ValueObject * GetParent()57 GetParent() 58 { 59 if (m_parent) 60 return m_parent->GetParent(); 61 else 62 return NULL; 63 } 64 65 virtual const ValueObject * GetParent()66 GetParent() const 67 { 68 if (m_parent) 69 return m_parent->GetParent(); 70 else 71 return NULL; 72 } 73 74 virtual lldb::ValueObjectSP GetStaticValue()75 GetStaticValue () 76 { 77 return m_parent->GetSP(); 78 } 79 80 void SetOwningSP(lldb::ValueObjectSP & owning_sp)81 SetOwningSP (lldb::ValueObjectSP &owning_sp) 82 { 83 if (m_owning_valobj_sp == owning_sp) 84 return; 85 86 assert (m_owning_valobj_sp.get() == NULL); 87 m_owning_valobj_sp = owning_sp; 88 } 89 90 virtual bool 91 SetValueFromCString (const char *value_str, Error& error); 92 93 virtual bool 94 SetData (DataExtractor &data, Error &error); 95 96 protected: 97 virtual bool 98 UpdateValue (); 99 100 virtual lldb::DynamicValueType GetDynamicValueTypeImpl()101 GetDynamicValueTypeImpl () 102 { 103 return m_use_dynamic; 104 } 105 106 virtual bool HasDynamicValueTypeInfo()107 HasDynamicValueTypeInfo () 108 { 109 return true; 110 } 111 112 virtual ClangASTType 113 GetClangTypeImpl (); 114 115 Address m_address; ///< The variable that this value object is based upon 116 TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name 117 lldb::ValueObjectSP m_owning_valobj_sp; 118 lldb::DynamicValueType m_use_dynamic; 119 120 private: 121 friend class ValueObject; 122 friend class ValueObjectConstResult; 123 ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic); 124 125 //------------------------------------------------------------------ 126 // For ValueObject only 127 //------------------------------------------------------------------ 128 DISALLOW_COPY_AND_ASSIGN (ValueObjectDynamicValue); 129 }; 130 131 } // namespace lldb_private 132 133 #endif // liblldb_ValueObjectDynamicValue_h_ 134