]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResult.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r301441, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Core / ValueObjectConstResult.h
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 #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
24
25 #include <stddef.h> // for size_t
26 #include <stdint.h> // for uint32_t, uint64_t
27
28 namespace lldb_private {
29 class DataExtractor;
30 }
31 namespace lldb_private {
32 class ExecutionContextScope;
33 }
34 namespace lldb_private {
35 class Module;
36 }
37 namespace lldb_private {
38
39 //----------------------------------------------------------------------
40 // A frozen ValueObject copied into host memory
41 //----------------------------------------------------------------------
42 class ValueObjectConstResult : public ValueObject {
43 public:
44   ~ValueObjectConstResult() override;
45
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);
49
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);
54
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);
60
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);
65
66   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
67                                     Value &value, const ConstString &name,
68                                     Module *module = nullptr);
69
70   // When an expression fails to evaluate, we return an error
71   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
72                                     const Error &error);
73
74   uint64_t GetByteSize() override;
75
76   lldb::ValueType GetValueType() const override;
77
78   size_t CalculateNumChildren(uint32_t max) override;
79
80   ConstString GetTypeName() override;
81
82   ConstString GetDisplayTypeName() override;
83
84   bool IsInScope() override;
85
86   void SetByteSize(size_t size);
87
88   lldb::ValueObjectSP Dereference(Error &error) override;
89
90   ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
91                                   int32_t synthetic_index) override;
92
93   lldb::ValueObjectSP GetSyntheticChildAtOffset(
94       uint32_t offset, const CompilerType &type, bool can_create,
95       ConstString name_const_str = ConstString()) override;
96
97   lldb::ValueObjectSP AddressOf(Error &error) override;
98
99   lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
100                             AddressType *address_type = nullptr) override;
101
102   size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
103                         uint32_t item_count = 1) override;
104
105   lldb::addr_t GetLiveAddress() override { return m_impl.GetLiveAddress(); }
106
107   void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
108                       AddressType address_type = eAddressTypeLoad) override {
109     m_impl.SetLiveAddress(addr, address_type);
110   }
111
112   lldb::ValueObjectSP
113   GetDynamicValue(lldb::DynamicValueType valueType) override;
114
115   lldb::LanguageType GetPreferredDisplayLanguage() override;
116
117   lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
118
119 protected:
120   bool UpdateValue() override;
121
122   CompilerType GetCompilerTypeImpl() override;
123
124   ConstString m_type_name;
125   uint64_t m_byte_size;
126
127   ValueObjectConstResultImpl m_impl;
128
129 private:
130   friend class ValueObjectConstResultImpl;
131
132   ValueObjectConstResult(ExecutionContextScope *exe_scope,
133                          lldb::ByteOrder byte_order, uint32_t addr_byte_size,
134                          lldb::addr_t address);
135
136   ValueObjectConstResult(ExecutionContextScope *exe_scope,
137                          const CompilerType &compiler_type,
138                          const ConstString &name, const DataExtractor &data,
139                          lldb::addr_t address);
140
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);
147
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);
152
153   ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value,
154                          const ConstString &name, Module *module = nullptr);
155
156   ValueObjectConstResult(ExecutionContextScope *exe_scope, const Error &error);
157
158   DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult);
159 };
160
161 } // namespace lldb_private
162
163 #endif // liblldb_ValueObjectConstResult_h_