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"
17#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 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
55 ConstString name, lldb::addr_t address,
56 AddressType address_type, uint32_t addr_byte_size);
57
59 Value &value, ConstString name,
60 Module *module = nullptr);
61
62 // When an expression fails to evaluate, we return an error
64 const Status &error);
65
66 std::optional<uint64_t> GetByteSize() override;
67
68 lldb::ValueType GetValueType() const override;
69
70 llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
71
72 ConstString GetTypeName() override;
73
75
76 bool IsInScope() override;
77
78 void SetByteSize(size_t size);
79
81
83 uint32_t offset, const CompilerType &type, bool can_create,
84 ConstString name_const_str = ConstString()) override;
85
87
88 lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
89 AddressType *address_type = nullptr) override;
90
91 size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
92 uint32_t item_count = 1) override;
93
95
97 AddressType address_type = eAddressTypeLoad) override {
98 m_impl.SetLiveAddress(addr, address_type);
99 }
100
102 GetDynamicValue(lldb::DynamicValueType valueType) override;
103
105
106 lldb::ValueObjectSP DoCast(const CompilerType &compiler_type) override;
107
108protected:
109 bool UpdateValue() override;
110
112
114 std::optional<uint64_t> m_byte_size;
115
117
118private:
120
122 ValueObjectManager &manager,
123 lldb::ByteOrder byte_order, uint32_t addr_byte_size,
124 lldb::addr_t address);
125
127 ValueObjectManager &manager,
128 const CompilerType &compiler_type, ConstString name,
129 const DataExtractor &data, lldb::addr_t address);
130
132 ValueObjectManager &manager,
133 const CompilerType &compiler_type, ConstString name,
134 const lldb::DataBufferSP &result_data_sp,
135 lldb::ByteOrder byte_order, uint32_t addr_size,
136 lldb::addr_t address);
137
139 ValueObjectManager &manager,
140 const CompilerType &compiler_type, ConstString name,
141 lldb::addr_t address, AddressType address_type,
142 uint32_t addr_byte_size);
143
145 ValueObjectManager &manager, const Value &value,
146 ConstString name, Module *module = nullptr);
147
149 ValueObjectManager &manager, const Status &error);
150
151 ValueObject *CreateChildAtIndex(size_t idx) override {
152 return m_impl.CreateChildAtIndex(idx);
153 }
156 }
157
161};
162
163} // namespace lldb_private
164
165#endif // LLDB_CORE_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:88
An error handling class.
Definition: Status.h:44
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:480
LanguageType
Programming language type.
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:334
uint64_t addr_t
Definition: lldb-types.h:80