1 //===-- ValueObjectConstResult.h --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ValueObjectConstResult_h_
11 #define liblldb_ValueObjectConstResult_h_
15 // Other libraries and framework includes
17 #include "lldb/Core/ValueObject.h"
19 #include "lldb/Core/ValueObjectConstResultImpl.h"
21 namespace lldb_private {
23 //----------------------------------------------------------------------
24 // A frozen ValueObject copied into host memory
25 //----------------------------------------------------------------------
26 class ValueObjectConstResult : public ValueObject {
28 ~ValueObjectConstResult() override;
30 static lldb::ValueObjectSP
31 Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
32 uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
34 static lldb::ValueObjectSP
35 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
36 const ConstString &name, const DataExtractor &data,
37 lldb::addr_t address = LLDB_INVALID_ADDRESS);
39 static lldb::ValueObjectSP
40 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
41 const ConstString &name, const lldb::DataBufferSP &result_data_sp,
42 lldb::ByteOrder byte_order, uint32_t addr_size,
43 lldb::addr_t address = LLDB_INVALID_ADDRESS);
45 static lldb::ValueObjectSP
46 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
47 const ConstString &name, lldb::addr_t address,
48 AddressType address_type, uint32_t addr_byte_size);
50 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
51 Value &value, const ConstString &name,
52 Module *module = nullptr);
54 // When an expression fails to evaluate, we return an error
55 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
58 uint64_t GetByteSize() override;
60 lldb::ValueType GetValueType() const override;
62 size_t CalculateNumChildren(uint32_t max) override;
64 ConstString GetTypeName() override;
66 ConstString GetDisplayTypeName() override;
68 bool IsInScope() override;
70 void SetByteSize(size_t size);
72 lldb::ValueObjectSP Dereference(Error &error) override;
74 ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
75 int32_t synthetic_index) override;
77 lldb::ValueObjectSP GetSyntheticChildAtOffset(
78 uint32_t offset, const CompilerType &type, bool can_create,
79 ConstString name_const_str = ConstString()) override;
81 lldb::ValueObjectSP AddressOf(Error &error) override;
83 lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
84 AddressType *address_type = nullptr) override;
86 size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
87 uint32_t item_count = 1) override;
89 lldb::addr_t GetLiveAddress() override { return m_impl.GetLiveAddress(); }
91 void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
92 AddressType address_type = eAddressTypeLoad) override {
93 m_impl.SetLiveAddress(addr, address_type);
97 GetDynamicValue(lldb::DynamicValueType valueType) override;
99 lldb::LanguageType GetPreferredDisplayLanguage() override;
101 lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
104 bool UpdateValue() override;
106 CompilerType GetCompilerTypeImpl() override;
108 ConstString m_type_name;
109 uint64_t m_byte_size;
111 ValueObjectConstResultImpl m_impl;
114 friend class ValueObjectConstResultImpl;
116 ValueObjectConstResult(ExecutionContextScope *exe_scope,
117 lldb::ByteOrder byte_order, uint32_t addr_byte_size,
118 lldb::addr_t address);
120 ValueObjectConstResult(ExecutionContextScope *exe_scope,
121 const CompilerType &compiler_type,
122 const ConstString &name, const DataExtractor &data,
123 lldb::addr_t address);
125 ValueObjectConstResult(ExecutionContextScope *exe_scope,
126 const CompilerType &compiler_type,
127 const ConstString &name,
128 const lldb::DataBufferSP &result_data_sp,
129 lldb::ByteOrder byte_order, uint32_t addr_size,
130 lldb::addr_t address);
132 ValueObjectConstResult(ExecutionContextScope *exe_scope,
133 const CompilerType &compiler_type,
134 const ConstString &name, lldb::addr_t address,
135 AddressType address_type, uint32_t addr_byte_size);
137 ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value,
138 const ConstString &name, Module *module = nullptr);
140 ValueObjectConstResult(ExecutionContextScope *exe_scope, const Error &error);
142 DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult);
145 } // namespace lldb_private
147 #endif // liblldb_ValueObjectConstResult_h_