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 ~ValueObjectConstResult() override; 30 31 static lldb::ValueObjectSP 32 Create (ExecutionContextScope *exe_scope, 33 lldb::ByteOrder byte_order, 34 uint32_t addr_byte_size, 35 lldb::addr_t address = LLDB_INVALID_ADDRESS); 36 37 static lldb::ValueObjectSP 38 Create (ExecutionContextScope *exe_scope, 39 const CompilerType &compiler_type, 40 const ConstString &name, 41 const DataExtractor &data, 42 lldb::addr_t address = LLDB_INVALID_ADDRESS); 43 44 static lldb::ValueObjectSP 45 Create (ExecutionContextScope *exe_scope, 46 const CompilerType &compiler_type, 47 const ConstString &name, 48 const lldb::DataBufferSP &result_data_sp, 49 lldb::ByteOrder byte_order, 50 uint32_t addr_size, 51 lldb::addr_t address = LLDB_INVALID_ADDRESS); 52 53 static lldb::ValueObjectSP 54 Create (ExecutionContextScope *exe_scope, 55 const CompilerType &compiler_type, 56 const ConstString &name, 57 lldb::addr_t address, 58 AddressType address_type, 59 uint32_t addr_byte_size); 60 61 static lldb::ValueObjectSP 62 Create (ExecutionContextScope *exe_scope, 63 Value &value, 64 const ConstString &name, 65 Module* module = nullptr); 66 67 // When an expression fails to evaluate, we return an error 68 static lldb::ValueObjectSP 69 Create (ExecutionContextScope *exe_scope, 70 const Error& error); 71 72 uint64_t 73 GetByteSize() override; 74 75 lldb::ValueType 76 GetValueType() const override; 77 78 size_t 79 CalculateNumChildren(uint32_t max) override; 80 81 ConstString 82 GetTypeName() override; 83 84 ConstString 85 GetDisplayTypeName() override; 86 87 bool 88 IsInScope() override; 89 90 void 91 SetByteSize (size_t size); 92 93 lldb::ValueObjectSP 94 Dereference(Error &error) override; 95 96 ValueObject * 97 CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; 98 99 lldb::ValueObjectSP 100 GetSyntheticChildAtOffset(uint32_t offset, 101 const CompilerType& type, 102 bool can_create, 103 ConstString name_const_str = ConstString()) override; 104 105 lldb::ValueObjectSP 106 AddressOf(Error &error) override; 107 108 lldb::addr_t 109 GetAddressOf(bool scalar_is_load_address = true, 110 AddressType *address_type = nullptr) override; 111 112 size_t 113 GetPointeeData(DataExtractor& data, 114 uint32_t item_idx = 0, 115 uint32_t item_count = 1) override; 116 117 lldb::addr_t 118 GetLiveAddress() override 119 { 120 return m_impl.GetLiveAddress(); 121 } 122 123 void 124 SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS, 125 AddressType address_type = eAddressTypeLoad) override 126 { 127 m_impl.SetLiveAddress(addr, address_type); 128 } 129 130 lldb::ValueObjectSP 131 GetDynamicValue(lldb::DynamicValueType valueType) override; 132 133 lldb::LanguageType 134 GetPreferredDisplayLanguage() override; 135 136 lldb::ValueObjectSP 137 Cast(const CompilerType &compiler_type) override; 138 139 protected: 140 bool 141 UpdateValue() override; 142 143 CompilerType 144 GetCompilerTypeImpl() override; 145 146 ConstString m_type_name; 147 uint64_t m_byte_size; 148 149 ValueObjectConstResultImpl m_impl; 150 151 private: 152 friend class ValueObjectConstResultImpl; 153 154 ValueObjectConstResult (ExecutionContextScope *exe_scope, 155 lldb::ByteOrder byte_order, 156 uint32_t addr_byte_size, 157 lldb::addr_t address); 158 159 ValueObjectConstResult (ExecutionContextScope *exe_scope, 160 const CompilerType &compiler_type, 161 const ConstString &name, 162 const DataExtractor &data, 163 lldb::addr_t address); 164 165 ValueObjectConstResult (ExecutionContextScope *exe_scope, 166 const CompilerType &compiler_type, 167 const ConstString &name, 168 const lldb::DataBufferSP &result_data_sp, 169 lldb::ByteOrder byte_order, 170 uint32_t addr_size, 171 lldb::addr_t address); 172 173 ValueObjectConstResult (ExecutionContextScope *exe_scope, 174 const CompilerType &compiler_type, 175 const ConstString &name, 176 lldb::addr_t address, 177 AddressType address_type, 178 uint32_t addr_byte_size); 179 180 ValueObjectConstResult (ExecutionContextScope *exe_scope, 181 const Value &value, 182 const ConstString &name, 183 Module* module = nullptr); 184 185 ValueObjectConstResult (ExecutionContextScope *exe_scope, 186 const Error& error); 187 188 DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResult); 189 }; 190 191 } // namespace lldb_private 192 193 #endif // liblldb_ValueObjectConstResult_h_ 194