1 //===-- ValueObjectConstResult.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_ValueObjectConstResult_h_ 11 #define liblldb_ValueObjectConstResult_h_ 12 13 // C Includes 14 // C++ Includes 15 // Other libraries and framework includes 16 // Project includes 17 #include "lldb/Core/ValueObject.h" 18 19 #include "lldb/Core/ValueObjectConstResultImpl.h" 20 21 namespace lldb_private { 22 23 //---------------------------------------------------------------------- 24 // A frozen ValueObject copied into host memory 25 //---------------------------------------------------------------------- 26 class ValueObjectConstResult : public ValueObject 27 { 28 public: 29 static lldb::ValueObjectSP 30 Create (ExecutionContextScope *exe_scope, 31 lldb::ByteOrder byte_order, 32 uint32_t addr_byte_size, 33 lldb::addr_t address = LLDB_INVALID_ADDRESS); 34 35 static lldb::ValueObjectSP 36 Create (ExecutionContextScope *exe_scope, 37 const ClangASTType &clang_type, 38 const ConstString &name, 39 const DataExtractor &data, 40 lldb::addr_t address = LLDB_INVALID_ADDRESS); 41 42 static lldb::ValueObjectSP 43 Create (ExecutionContextScope *exe_scope, 44 const ClangASTType &clang_type, 45 const ConstString &name, 46 const lldb::DataBufferSP &result_data_sp, 47 lldb::ByteOrder byte_order, 48 uint32_t addr_size, 49 lldb::addr_t address = LLDB_INVALID_ADDRESS); 50 51 static lldb::ValueObjectSP 52 Create (ExecutionContextScope *exe_scope, 53 const ClangASTType &clang_type, 54 const ConstString &name, 55 lldb::addr_t address, 56 AddressType address_type, 57 uint32_t addr_byte_size); 58 59 static lldb::ValueObjectSP 60 Create (ExecutionContextScope *exe_scope, 61 Value &value, 62 const ConstString &name); 63 64 // When an expression fails to evaluate, we return an error 65 static lldb::ValueObjectSP 66 Create (ExecutionContextScope *exe_scope, 67 const Error& error); 68 69 virtual ~ValueObjectConstResult(); 70 71 virtual uint64_t 72 GetByteSize(); 73 74 virtual lldb::ValueType 75 GetValueType() const; 76 77 virtual size_t 78 CalculateNumChildren(); 79 80 virtual ConstString 81 GetTypeName(); 82 83 virtual bool 84 IsInScope (); 85 86 void 87 SetByteSize (size_t size); 88 89 virtual lldb::ValueObjectSP 90 Dereference (Error &error); 91 92 virtual ValueObject * 93 CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index); 94 95 virtual lldb::ValueObjectSP 96 GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create); 97 98 virtual lldb::ValueObjectSP 99 AddressOf (Error &error); 100 101 virtual lldb::addr_t 102 GetAddressOf (bool scalar_is_load_address = true, 103 AddressType *address_type = NULL); 104 105 virtual size_t 106 GetPointeeData (DataExtractor& data, 107 uint32_t item_idx = 0, 108 uint32_t item_count = 1); 109 110 virtual lldb::addr_t GetLiveAddress()111 GetLiveAddress() 112 { 113 return m_impl.GetLiveAddress(); 114 } 115 116 virtual void 117 SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS, 118 AddressType address_type = eAddressTypeLoad) 119 { 120 m_impl.SetLiveAddress(addr, 121 address_type); 122 } 123 124 virtual lldb::ValueObjectSP 125 GetDynamicValue (lldb::DynamicValueType valueType); 126 127 protected: 128 virtual bool 129 UpdateValue (); 130 131 virtual ClangASTType 132 GetClangTypeImpl (); 133 134 ConstString m_type_name; 135 uint64_t m_byte_size; 136 137 ValueObjectConstResultImpl m_impl; 138 139 private: 140 friend class ValueObjectConstResultImpl; 141 ValueObjectConstResult (ExecutionContextScope *exe_scope, 142 lldb::ByteOrder byte_order, 143 uint32_t addr_byte_size, 144 lldb::addr_t address); 145 146 ValueObjectConstResult (ExecutionContextScope *exe_scope, 147 const ClangASTType &clang_type, 148 const ConstString &name, 149 const DataExtractor &data, 150 lldb::addr_t address); 151 152 ValueObjectConstResult (ExecutionContextScope *exe_scope, 153 const ClangASTType &clang_type, 154 const ConstString &name, 155 const lldb::DataBufferSP &result_data_sp, 156 lldb::ByteOrder byte_order, 157 uint32_t addr_size, 158 lldb::addr_t address); 159 160 ValueObjectConstResult (ExecutionContextScope *exe_scope, 161 const ClangASTType &clang_type, 162 const ConstString &name, 163 lldb::addr_t address, 164 AddressType address_type, 165 uint32_t addr_byte_size); 166 167 ValueObjectConstResult (ExecutionContextScope *exe_scope, 168 const Value &value, 169 const ConstString &name); 170 171 ValueObjectConstResult (ExecutionContextScope *exe_scope, 172 const Error& error); 173 174 DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResult); 175 }; 176 177 } // namespace lldb_private 178 179 #endif // liblldb_ValueObjectConstResult_h_ 180