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_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H
10#define LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H
11
12#include "lldb/Core/Value.h"
15#include "lldb/Utility/Status.h"
18#include "lldb/lldb-defines.h"
20#include "lldb/lldb-forward.h"
22#include "lldb/lldb-types.h"
23
24#include <cstddef>
25#include <cstdint>
26#include <optional>
27
28namespace lldb_private {
29class DataExtractor;
30class ExecutionContextScope;
31class Module;
32
33/// A frozen ValueObject copied into host memory.
35public:
37
39 Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
40 uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
41
43 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
44 ConstString name, const DataExtractor &data,
46
48 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
49 ConstString name, const lldb::DataBufferSP &result_data_sp,
50 lldb::ByteOrder byte_order, uint32_t addr_size,
52
54 const CompilerType &compiler_type,
55 ConstString name, lldb::addr_t address,
56 AddressType address_type,
57 uint32_t addr_byte_size);
58
60 Value &value, ConstString name,
61 Module *module = nullptr);
62
63 // When an expression fails to evaluate, we return an error
65 Status &&error);
66
67 std::optional<uint64_t> GetByteSize() override;
68
69 lldb::ValueType GetValueType() const override;
70
71 llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
72
73 ConstString GetTypeName() override;
74
76
77 bool IsInScope() override;
78
79 void SetByteSize(size_t size);
80
82
84 uint32_t offset, const CompilerType &type, bool can_create,
85 ConstString name_const_str = ConstString()) override;
86
88
89 lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
90 AddressType *address_type = nullptr) override;
91
92 size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
93 uint32_t item_count = 1) override;
94
96
98 AddressType address_type = eAddressTypeLoad) override {
99 m_impl.SetLiveAddress(addr, address_type);
100 }
101
103 GetDynamicValue(lldb::DynamicValueType valueType) override;
104
106
107 lldb::ValueObjectSP DoCast(const CompilerType &compiler_type) override;
108
109protected:
110 bool UpdateValue() override;
111
113
115 std::optional<uint64_t> m_byte_size;
116
118
119private:
121
123 ValueObjectManager &manager,
124 lldb::ByteOrder byte_order, uint32_t addr_byte_size,
125 lldb::addr_t address);
126
128 ValueObjectManager &manager,
129 const CompilerType &compiler_type, ConstString name,
130 const DataExtractor &data, lldb::addr_t address);
131
133 ValueObjectManager &manager,
134 const CompilerType &compiler_type, ConstString name,
135 const lldb::DataBufferSP &result_data_sp,
136 lldb::ByteOrder byte_order, uint32_t addr_size,
137 lldb::addr_t address);
138
140 ValueObjectManager &manager,
141 const CompilerType &compiler_type, ConstString name,
142 lldb::addr_t address, AddressType address_type,
143 uint32_t addr_byte_size);
144
146 ValueObjectManager &manager, const Value &value,
147 ConstString name, Module *module = nullptr);
148
150 ValueObjectManager &manager, Status &&error);
151
152 ValueObject *CreateChildAtIndex(size_t idx) override {
153 return m_impl.CreateChildAtIndex(idx);
154 }
157 }
158
162};
163
164} // namespace lldb_private
165
166#endif // LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H
static llvm::raw_ostream & error(Stream &strm)
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
A uniqued constant string class.
Definition: ConstString.h:40
An data extractor class.
Definition: DataExtractor.h:48
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:89
An error handling class.
Definition: Status.h:115
A class wrapping common implementation details for operations in ValueObjectConstResult ( & Child ) t...
void SetLiveAddress(lldb::addr_t addr=LLDB_INVALID_ADDRESS, AddressType address_type=eAddressTypeLoad)
A frozen ValueObject copied into host memory.
lldb::ValueObjectSP AddressOf(Status &error) override
void SetLiveAddress(lldb::addr_t addr=LLDB_INVALID_ADDRESS, AddressType address_type=eAddressTypeLoad) override
ValueObject * CreateSyntheticArrayMember(size_t idx) override
Should only be called by ValueObject::GetSyntheticArrayMember().
std::optional< uint64_t > GetByteSize() override
lldb::ValueObjectSP Dereference(Status &error) override
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
lldb::ValueObjectSP DoCast(const CompilerType &compiler_type) override
ValueObjectConstResult(const ValueObjectConstResult &)=delete
const ValueObjectConstResult & operator=(const ValueObjectConstResult &)=delete
ValueObject * CreateChildAtIndex(size_t idx) override
Should only be called by ValueObject::GetChildAtIndex().
lldb::addr_t GetAddressOf(bool scalar_is_load_address=true, AddressType *address_type=nullptr) override
lldb::ValueObjectSP GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str=ConstString()) override
lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType) override
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
lldb::ValueType GetValueType() const override
size_t GetPointeeData(DataExtractor &data, uint32_t item_idx=0, uint32_t item_count=1) override
lldb::LanguageType GetPreferredDisplayLanguage() override
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
A class that represents a running process on the host machine.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:484
LanguageType
Programming language type.
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:336
uint64_t addr_t
Definition: lldb-types.h:80