ValueObjectDynamicValue.h revision 263363
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 20namespace lldb_private { 21 22//---------------------------------------------------------------------- 23// A ValueObject that represents memory at a given address, viewed as some 24// set lldb type. 25//---------------------------------------------------------------------- 26class ValueObjectDynamicValue : public ValueObject 27{ 28public: 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 51 IsDynamic () 52 { 53 return true; 54 } 55 56 virtual ValueObject * 57 GetParent() 58 { 59 if (m_parent) 60 return m_parent->GetParent(); 61 else 62 return NULL; 63 } 64 65 virtual const ValueObject * 66 GetParent() const 67 { 68 if (m_parent) 69 return m_parent->GetParent(); 70 else 71 return NULL; 72 } 73 74 virtual lldb::ValueObjectSP 75 GetStaticValue () 76 { 77 return m_parent->GetSP(); 78 } 79 80 void 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 virtual TypeImpl 97 GetTypeImpl (); 98 99protected: 100 virtual bool 101 UpdateValue (); 102 103 virtual lldb::DynamicValueType 104 GetDynamicValueTypeImpl () 105 { 106 return m_use_dynamic; 107 } 108 109 virtual bool 110 HasDynamicValueTypeInfo () 111 { 112 return true; 113 } 114 115 virtual ClangASTType 116 GetClangTypeImpl (); 117 118 Address m_address; ///< The variable that this value object is based upon 119 TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name 120 lldb::ValueObjectSP m_owning_valobj_sp; 121 lldb::DynamicValueType m_use_dynamic; 122 TypeImpl m_type_impl; 123 124private: 125 friend class ValueObject; 126 friend class ValueObjectConstResult; 127 ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic); 128 129 //------------------------------------------------------------------ 130 // For ValueObject only 131 //------------------------------------------------------------------ 132 DISALLOW_COPY_AND_ASSIGN (ValueObjectDynamicValue); 133}; 134 135} // namespace lldb_private 136 137#endif // liblldb_ValueObjectDynamicValue_h_ 138