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
38 static lldb::ValueObjectSP
39 Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
40 uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
41
42 static lldb::ValueObjectSP
43 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
44 ConstString name, const DataExtractor &data,
46
47 static lldb::ValueObjectSP
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
53 static lldb::ValueObjectSP
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
58 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
59 Value &value, ConstString name,
60 Module *module = nullptr);
61
62 // When an expression fails to evaluate, we return an error
63 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
64 const Status &error);
65
66 std::optional<uint64_t> GetByteSize() override;
67
68 lldb::ValueType GetValueType() const override;
69
70 size_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
80 lldb::ValueObjectSP Dereference(Status &error) override;
81
82 ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
83 int32_t synthetic_index) override;
84
85 lldb::ValueObjectSP GetSyntheticChildAtOffset(
86 uint32_t offset, const CompilerType &type, bool can_create,
87 ConstString name_const_str = ConstString()) override;
88
89 lldb::ValueObjectSP AddressOf(Status &error) override;
90
91 lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
92 AddressType *address_type = nullptr) override;
93
94 size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
95 uint32_t item_count = 1) override;
96
98
100 AddressType address_type = eAddressTypeLoad) override {
101 m_impl.SetLiveAddress(addr, address_type);
102 }
103
104 lldb::ValueObjectSP
105 GetDynamicValue(lldb::DynamicValueType valueType) override;
106
108
109 lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
110
111protected:
112 bool UpdateValue() override;
113
115
117 std::optional<uint64_t> m_byte_size;
118
120
121private:
123
125 ValueObjectManager &manager,
126 lldb::ByteOrder byte_order, uint32_t addr_byte_size,
127 lldb::addr_t address);
128
130 ValueObjectManager &manager,
131 const CompilerType &compiler_type, ConstString name,
132 const DataExtractor &data, lldb::addr_t address);
133
135 ValueObjectManager &manager,
136 const CompilerType &compiler_type, ConstString name,
137 const lldb::DataBufferSP &result_data_sp,
138 lldb::ByteOrder byte_order, uint32_t addr_size,
139 lldb::addr_t address);
140
142 ValueObjectManager &manager,
143 const CompilerType &compiler_type, ConstString name,
144 lldb::addr_t address, AddressType address_type,
145 uint32_t addr_byte_size);
146
148 ValueObjectManager &manager, const Value &value,
149 ConstString name, Module *module = nullptr);
150
152 ValueObjectManager &manager, const Status &error);
153
157};
158
159} // namespace lldb_private
160
161#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:39
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
std::optional< uint64_t > GetByteSize() override
lldb::ValueObjectSP Dereference(Status &error) override
size_t CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
ValueObject * CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override
Should only be called by ValueObject::GetChildAtIndex().
lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override
ValueObjectConstResult(const ValueObjectConstResult &)=delete
const ValueObjectConstResult & operator=(const ValueObjectConstResult &)=delete
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
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:74
A class that represents a running process on the host machine.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
LanguageType
Programming language type.
ByteOrder
Byte ordering definitions.
uint64_t addr_t
Definition: lldb-types.h:83