1 //===-- ValueObjectConstResultImpl.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_ValueObjectConstResultImpl_h_ 11 #define liblldb_ValueObjectConstResultImpl_h_ 12 13 #include "lldb/Utility/ConstString.h" 14 #include "lldb/lldb-defines.h" 15 #include "lldb/lldb-forward.h" 16 #include "lldb/lldb-private-enumerations.h" 17 #include "lldb/lldb-types.h" 18 19 #include <stddef.h> 20 #include <stdint.h> 21 namespace lldb_private { 22 class CompilerType; 23 } 24 namespace lldb_private { 25 class DataExtractor; 26 } 27 namespace lldb_private { 28 class Status; 29 } 30 namespace lldb_private { 31 class ValueObject; 32 } 33 34 namespace lldb_private { 35 36 //---------------------------------------------------------------------- 37 // A class wrapping common implementation details for operations in 38 // ValueObjectConstResult ( & Child ) that may need to jump from the host 39 // memory space into the target's memory space 40 //---------------------------------------------------------------------- 41 class ValueObjectConstResultImpl { 42 public: 43 ValueObjectConstResultImpl(ValueObject *valobj, 44 lldb::addr_t live_address = LLDB_INVALID_ADDRESS); 45 46 virtual ~ValueObjectConstResultImpl() = default; 47 48 lldb::ValueObjectSP Dereference(Status &error); 49 50 ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, 51 int32_t synthetic_index); 52 53 lldb::ValueObjectSP 54 GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, 55 bool can_create, 56 ConstString name_const_str = ConstString()); 57 58 lldb::ValueObjectSP AddressOf(Status &error); 59 GetLiveAddress()60 lldb::addr_t GetLiveAddress() { return m_live_address; } 61 62 lldb::ValueObjectSP Cast(const CompilerType &compiler_type); 63 64 void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS, 65 AddressType address_type = eAddressTypeLoad) { 66 m_live_address = addr; 67 m_live_address_type = address_type; 68 } 69 70 virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, 71 AddressType *address_type = nullptr); 72 73 virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, 74 uint32_t item_count = 1); 75 76 private: 77 ValueObject *m_impl_backend; 78 lldb::addr_t m_live_address; 79 AddressType m_live_address_type; 80 lldb::ValueObjectSP m_load_addr_backend; 81 lldb::ValueObjectSP m_address_of_backend; 82 83 DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResultImpl); 84 }; 85 86 } // namespace lldb_private 87 88 #endif // liblldb_ValueObjectConstResultImpl_h_ 89