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_
13 #include "lldb/Core/Value.h" // for Value
14 #include "lldb/Core/ValueObject.h"
15 #include "lldb/Core/ValueObjectConstResultImpl.h"
16 #include "lldb/Symbol/CompilerType.h" // for CompilerType
17 #include "lldb/Utility/ConstString.h" // for ConstString
18 #include "lldb/Utility/Error.h" // for Error
19 #include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS
20 #include "lldb/lldb-enumerations.h" // for ByteOrder, Dynamic...
21 #include "lldb/lldb-forward.h" // for ValueObjectSP, Dat...
22 #include "lldb/lldb-private-enumerations.h" // for AddressType, Addre...
23 #include "lldb/lldb-types.h" // for addr_t
25 #include <stddef.h> // for size_t
26 #include <stdint.h> // for uint32_t, uint64_t
28 namespace lldb_private {
31 namespace lldb_private {
32 class ExecutionContextScope;
34 namespace lldb_private {
37 namespace lldb_private {
39 //----------------------------------------------------------------------
40 // A frozen ValueObject copied into host memory
41 //----------------------------------------------------------------------
42 class ValueObjectConstResult : public ValueObject {
44 ~ValueObjectConstResult() override;
46 static lldb::ValueObjectSP
47 Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
48 uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
50 static lldb::ValueObjectSP
51 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
52 const ConstString &name, const DataExtractor &data,
53 lldb::addr_t address = LLDB_INVALID_ADDRESS);
55 static lldb::ValueObjectSP
56 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
57 const ConstString &name, const lldb::DataBufferSP &result_data_sp,
58 lldb::ByteOrder byte_order, uint32_t addr_size,
59 lldb::addr_t address = LLDB_INVALID_ADDRESS);
61 static lldb::ValueObjectSP
62 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
63 const ConstString &name, lldb::addr_t address,
64 AddressType address_type, uint32_t addr_byte_size);
66 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
67 Value &value, const ConstString &name,
68 Module *module = nullptr);
70 // When an expression fails to evaluate, we return an error
71 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
74 uint64_t GetByteSize() override;
76 lldb::ValueType GetValueType() const override;
78 size_t CalculateNumChildren(uint32_t max) override;
80 ConstString GetTypeName() override;
82 ConstString GetDisplayTypeName() override;
84 bool IsInScope() override;
86 void SetByteSize(size_t size);
88 lldb::ValueObjectSP Dereference(Error &error) override;
90 ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
91 int32_t synthetic_index) override;
93 lldb::ValueObjectSP GetSyntheticChildAtOffset(
94 uint32_t offset, const CompilerType &type, bool can_create,
95 ConstString name_const_str = ConstString()) override;
97 lldb::ValueObjectSP AddressOf(Error &error) override;
99 lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
100 AddressType *address_type = nullptr) override;
102 size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
103 uint32_t item_count = 1) override;
105 lldb::addr_t GetLiveAddress() override { return m_impl.GetLiveAddress(); }
107 void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
108 AddressType address_type = eAddressTypeLoad) override {
109 m_impl.SetLiveAddress(addr, address_type);
113 GetDynamicValue(lldb::DynamicValueType valueType) override;
115 lldb::LanguageType GetPreferredDisplayLanguage() override;
117 lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
120 bool UpdateValue() override;
122 CompilerType GetCompilerTypeImpl() override;
124 ConstString m_type_name;
125 uint64_t m_byte_size;
127 ValueObjectConstResultImpl m_impl;
130 friend class ValueObjectConstResultImpl;
132 ValueObjectConstResult(ExecutionContextScope *exe_scope,
133 lldb::ByteOrder byte_order, uint32_t addr_byte_size,
134 lldb::addr_t address);
136 ValueObjectConstResult(ExecutionContextScope *exe_scope,
137 const CompilerType &compiler_type,
138 const ConstString &name, const DataExtractor &data,
139 lldb::addr_t address);
141 ValueObjectConstResult(ExecutionContextScope *exe_scope,
142 const CompilerType &compiler_type,
143 const ConstString &name,
144 const lldb::DataBufferSP &result_data_sp,
145 lldb::ByteOrder byte_order, uint32_t addr_size,
146 lldb::addr_t address);
148 ValueObjectConstResult(ExecutionContextScope *exe_scope,
149 const CompilerType &compiler_type,
150 const ConstString &name, lldb::addr_t address,
151 AddressType address_type, uint32_t addr_byte_size);
153 ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value,
154 const ConstString &name, Module *module = nullptr);
156 ValueObjectConstResult(ExecutionContextScope *exe_scope, const Error &error);
158 DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult);
161 } // namespace lldb_private
163 #endif // liblldb_ValueObjectConstResult_h_