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