LLDB  mainline
ValueObjectConstResult.h
Go to the documentation of this file.
1 //===-- ValueObjectConstResult.h --------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_CORE_VALUEOBJECTCONSTRESULT_H
10 #define LLDB_CORE_VALUEOBJECTCONSTRESULT_H
11 
12 #include "lldb/Core/Value.h"
13 #include "lldb/Core/ValueObject.h"
17 #include "lldb/Utility/Status.h"
18 #include "lldb/lldb-defines.h"
19 #include "lldb/lldb-enumerations.h"
20 #include "lldb/lldb-forward.h"
22 #include "lldb/lldb-types.h"
23 
24 #include <cstddef>
25 #include <cstdint>
26 
27 namespace lldb_private {
28 class DataExtractor;
29 class ExecutionContextScope;
30 class Module;
31 
32 /// A frozen ValueObject copied into host memory.
34 public:
35  ~ValueObjectConstResult() override;
36 
37  static lldb::ValueObjectSP
38  Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
39  uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
40 
41  static lldb::ValueObjectSP
42  Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
43  ConstString name, const DataExtractor &data,
45 
46  static lldb::ValueObjectSP
47  Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
48  ConstString name, const lldb::DataBufferSP &result_data_sp,
49  lldb::ByteOrder byte_order, uint32_t addr_size,
51 
52  static lldb::ValueObjectSP
53  Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
54  ConstString name, lldb::addr_t address,
55  AddressType address_type, uint32_t addr_byte_size);
56 
57  static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
58  Value &value, ConstString name,
59  Module *module = nullptr);
60 
61  // When an expression fails to evaluate, we return an error
62  static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
63  const Status &error);
64 
65  llvm::Optional<uint64_t> GetByteSize() override;
66 
67  lldb::ValueType GetValueType() const override;
68 
69  size_t CalculateNumChildren(uint32_t max) override;
70 
71  ConstString GetTypeName() override;
72 
74 
75  bool IsInScope() override;
76 
77  void SetByteSize(size_t size);
78 
79  lldb::ValueObjectSP Dereference(Status &error) override;
80 
81  ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
82  int32_t synthetic_index) override;
83 
84  lldb::ValueObjectSP GetSyntheticChildAtOffset(
85  uint32_t offset, const CompilerType &type, bool can_create,
86  ConstString name_const_str = ConstString()) override;
87 
88  lldb::ValueObjectSP AddressOf(Status &error) override;
89 
90  lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
91  AddressType *address_type = nullptr) override;
92 
93  size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
94  uint32_t item_count = 1) override;
95 
97 
99  AddressType address_type = eAddressTypeLoad) override {
100  m_impl.SetLiveAddress(addr, address_type);
101  }
102 
103  lldb::ValueObjectSP
104  GetDynamicValue(lldb::DynamicValueType valueType) override;
105 
107 
108  lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
109 
110 protected:
111  bool UpdateValue() override;
112 
114 
116  llvm::Optional<uint64_t> m_byte_size;
117 
119 
120 private:
122 
124  ValueObjectManager &manager,
125  lldb::ByteOrder byte_order, uint32_t addr_byte_size,
126  lldb::addr_t address);
127 
129  ValueObjectManager &manager,
130  const CompilerType &compiler_type, ConstString name,
131  const DataExtractor &data, lldb::addr_t address);
132 
134  ValueObjectManager &manager,
135  const CompilerType &compiler_type, ConstString name,
136  const lldb::DataBufferSP &result_data_sp,
137  lldb::ByteOrder byte_order, uint32_t addr_size,
138  lldb::addr_t address);
139 
141  ValueObjectManager &manager,
142  const CompilerType &compiler_type, ConstString name,
143  lldb::addr_t address, AddressType address_type,
144  uint32_t addr_byte_size);
145 
147  ValueObjectManager &manager, const Value &value,
148  ConstString name, Module *module = nullptr);
149 
151  ValueObjectManager &manager, const Status &error);
152 
154  const ValueObjectConstResult &
155  operator=(const ValueObjectConstResult &) = delete;
156 };
157 
158 } // namespace lldb_private
159 
160 #endif // LLDB_CORE_VALUEOBJECTCONSTRESULT_H
lldb_private::ValueObjectConstResult::GetDisplayTypeName
ConstString GetDisplayTypeName() override
Definition: ValueObjectConstResult.cpp:230
lldb_private::ValueObjectConstResult::SetLiveAddress
void SetLiveAddress(lldb::addr_t addr=LLDB_INVALID_ADDRESS, AddressType address_type=eAddressTypeLoad) override
Definition: ValueObjectConstResult.h:98
lldb_private::ValueObjectConstResultImpl::SetLiveAddress
void SetLiveAddress(lldb::addr_t addr=LLDB_INVALID_ADDRESS, AddressType address_type=eAddressTypeLoad)
Definition: ValueObjectConstResultImpl.h:55
lldb_private::ValueObjectConstResult::Cast
lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override
Definition: ValueObjectConstResult.cpp:296
lldb_private::Value
Definition: Value.h:38
lldb-defines.h
lldb_private::ValueObjectConstResult::GetPreferredDisplayLanguage
lldb::LanguageType GetPreferredDisplayLanguage() override
Definition: ValueObjectConstResult.cpp:300
lldb_private::AddressType
AddressType
Definition: lldb-private-enumerations.h:30
lldb_private::ClusterManager
Definition: SharedCluster.h:22
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::ValueObjectConstResult::GetAddressOf
lldb::addr_t GetAddressOf(bool scalar_is_load_address=true, AddressType *address_type=nullptr) override
Definition: ValueObjectConstResult.cpp:261
lldb_private::Module
Definition: Module.h:85
lldb_private::ValueObjectConstResult::GetValueType
lldb::ValueType GetValueType() const override
Definition: ValueObjectConstResult.cpp:202
lldb_private::CompilerContextKind::Module
@ Module
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb-private-enumerations.h
ValueObjectConstResultImpl.h
lldb_private::ValueObjectConstResult::IsInScope
bool IsInScope() override
Definition: ValueObjectConstResult.cpp:240
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ValueObjectConstResult::GetCompilerTypeImpl
CompilerType GetCompilerTypeImpl() override
Definition: ValueObjectConstResult.cpp:198
lldb_private::ValueObjectConstResult::AddressOf
lldb::ValueObjectSP AddressOf(Status &error) override
Definition: ValueObjectConstResult.cpp:257
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::ValueObjectConstResult::SetByteSize
void SetByteSize(size_t size)
Definition: ValueObjectConstResult.cpp:216
lldb_private::ValueObjectConstResultImpl::GetLiveAddress
lldb::addr_t GetLiveAddress()
Definition: ValueObjectConstResultImpl.h:51
lldb_private::ValueObjectConstResult::m_impl
ValueObjectConstResultImpl m_impl
Definition: ValueObjectConstResult.h:118
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::ValueObjectConstResult::CalculateNumChildren
size_t CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
Definition: ValueObjectConstResult.cpp:218
lldb_private::ValueObjectConstResult::operator=
const ValueObjectConstResult & operator=(const ValueObjectConstResult &)=delete
lldb-enumerations.h
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
lldb_private::eAddressTypeLoad
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
Definition: lldb-private-enumerations.h:34
CompilerType.h
lldb_private::ValueObjectConstResult::m_type_name
ConstString m_type_name
Definition: ValueObjectConstResult.h:115
ValueObject.h
lldb-types.h
lldb_private::ValueObjectConstResult::CreateChildAtIndex
ValueObject * CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override
Should only be called by ValueObject::GetChildAtIndex().
Definition: ValueObjectConstResult.cpp:266
lldb_private::ValueObjectConstResult::GetSyntheticChildAtOffset
lldb::ValueObjectSP GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str=ConstString()) override
Definition: ValueObjectConstResult.cpp:250
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb::ValueType
ValueType
Definition: lldb-enumerations.h:315
uint32_t
lldb_private::ValueObjectConstResultImpl
A class wrapping common implementation details for operations in ValueObjectConstResult ( & Child ) t...
Definition: ValueObjectConstResultImpl.h:32
lldb_private::ValueObjectConstResult::GetLiveAddress
lldb::addr_t GetLiveAddress() override
Definition: ValueObjectConstResult.h:96
lldb_private::ValueObjectConstResult::GetByteSize
llvm::Optional< uint64_t > GetByteSize() override
Definition: ValueObjectConstResult.cpp:206
lldb_private::ValueObjectConstResult
A frozen ValueObject copied into host memory.
Definition: ValueObjectConstResult.h:33
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::ValueObjectConstResult::Create
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
Definition: ValueObjectConstResult.cpp:28
lldb-forward.h
lldb_private::ValueObjectConstResult::GetPointeeData
size_t GetPointeeData(DataExtractor &data, uint32_t item_idx=0, uint32_t item_count=1) override
Definition: ValueObjectConstResult.cpp:272
Status.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ValueObjectConstResult::m_byte_size
llvm::Optional< uint64_t > m_byte_size
Definition: ValueObjectConstResult.h:116
ConstString.h
lldb_private::ValueObjectConstResult::GetDynamicValue
lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType) override
Definition: ValueObjectConstResult.cpp:279
lldb_private::ValueObjectConstResult::ValueObjectConstResult
ValueObjectConstResult(ExecutionContextScope *exe_scope, ValueObjectManager &manager, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address)
Definition: ValueObjectConstResult.cpp:38
lldb_private::ValueObjectConstResult::UpdateValue
bool UpdateValue() override
Definition: ValueObjectConstResult.cpp:234
lldb_private::ValueObjectConstResult::Dereference
lldb::ValueObjectSP Dereference(Status &error) override
Definition: ValueObjectConstResult.cpp:246
Value.h
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
lldb_private::ValueObjectConstResult::~ValueObjectConstResult
~ValueObjectConstResult() override
lldb_private::ValueObjectConstResult::GetTypeName
ConstString GetTypeName() override
Definition: ValueObjectConstResult.cpp:224