File indexing completed on 2026-05-10 08:42:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H
0010 #define LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H
0011
0012 #include "lldb/Core/Value.h"
0013 #include "lldb/Symbol/CompilerType.h"
0014 #include "lldb/Utility/ConstString.h"
0015 #include "lldb/Utility/Status.h"
0016 #include "lldb/ValueObject/ValueObject.h"
0017 #include "lldb/ValueObject/ValueObjectConstResultImpl.h"
0018 #include "lldb/lldb-defines.h"
0019 #include "lldb/lldb-enumerations.h"
0020 #include "lldb/lldb-forward.h"
0021 #include "lldb/lldb-private-enumerations.h"
0022 #include "lldb/lldb-types.h"
0023
0024 #include <cstddef>
0025 #include <cstdint>
0026 #include <optional>
0027
0028 namespace lldb_private {
0029 class DataExtractor;
0030 class ExecutionContextScope;
0031 class Module;
0032
0033
0034 class ValueObjectConstResult : public ValueObject {
0035 public:
0036 ~ValueObjectConstResult() override;
0037
0038 static lldb::ValueObjectSP
0039 Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
0040 uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
0041
0042 static lldb::ValueObjectSP
0043 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
0044 ConstString name, const DataExtractor &data,
0045 lldb::addr_t address = LLDB_INVALID_ADDRESS);
0046
0047 static lldb::ValueObjectSP
0048 Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
0049 ConstString name, const lldb::DataBufferSP &result_data_sp,
0050 lldb::ByteOrder byte_order, uint32_t addr_size,
0051 lldb::addr_t address = LLDB_INVALID_ADDRESS);
0052
0053 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
0054 const CompilerType &compiler_type,
0055 ConstString name, lldb::addr_t address,
0056 AddressType address_type,
0057 uint32_t addr_byte_size);
0058
0059 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
0060 Value &value, ConstString name,
0061 Module *module = nullptr);
0062
0063
0064 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
0065 Status &&error);
0066
0067 std::optional<uint64_t> GetByteSize() override;
0068
0069 lldb::ValueType GetValueType() const override;
0070
0071 llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
0072
0073 ConstString GetTypeName() override;
0074
0075 ConstString GetDisplayTypeName() override;
0076
0077 bool IsInScope() override;
0078
0079 void SetByteSize(size_t size);
0080
0081 lldb::ValueObjectSP Dereference(Status &error) override;
0082
0083 lldb::ValueObjectSP GetSyntheticChildAtOffset(
0084 uint32_t offset, const CompilerType &type, bool can_create,
0085 ConstString name_const_str = ConstString()) override;
0086
0087 lldb::ValueObjectSP AddressOf(Status &error) override;
0088
0089 lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
0090 AddressType *address_type = nullptr) override;
0091
0092 size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
0093 uint32_t item_count = 1) override;
0094
0095 lldb::addr_t GetLiveAddress() override { return m_impl.GetLiveAddress(); }
0096
0097 void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
0098 AddressType address_type = eAddressTypeLoad) override {
0099 m_impl.SetLiveAddress(addr, address_type);
0100 }
0101
0102 lldb::ValueObjectSP
0103 GetDynamicValue(lldb::DynamicValueType valueType) override;
0104
0105 lldb::LanguageType GetPreferredDisplayLanguage() override;
0106
0107 lldb::ValueObjectSP DoCast(const CompilerType &compiler_type) override;
0108
0109 protected:
0110 bool UpdateValue() override;
0111
0112 CompilerType GetCompilerTypeImpl() override;
0113
0114 ConstString m_type_name;
0115 std::optional<uint64_t> m_byte_size;
0116
0117 ValueObjectConstResultImpl m_impl;
0118
0119 private:
0120 friend class ValueObjectConstResultImpl;
0121
0122 ValueObjectConstResult(ExecutionContextScope *exe_scope,
0123 ValueObjectManager &manager,
0124 lldb::ByteOrder byte_order, uint32_t addr_byte_size,
0125 lldb::addr_t address);
0126
0127 ValueObjectConstResult(ExecutionContextScope *exe_scope,
0128 ValueObjectManager &manager,
0129 const CompilerType &compiler_type, ConstString name,
0130 const DataExtractor &data, lldb::addr_t address);
0131
0132 ValueObjectConstResult(ExecutionContextScope *exe_scope,
0133 ValueObjectManager &manager,
0134 const CompilerType &compiler_type, ConstString name,
0135 const lldb::DataBufferSP &result_data_sp,
0136 lldb::ByteOrder byte_order, uint32_t addr_size,
0137 lldb::addr_t address);
0138
0139 ValueObjectConstResult(ExecutionContextScope *exe_scope,
0140 ValueObjectManager &manager,
0141 const CompilerType &compiler_type, ConstString name,
0142 lldb::addr_t address, AddressType address_type,
0143 uint32_t addr_byte_size);
0144
0145 ValueObjectConstResult(ExecutionContextScope *exe_scope,
0146 ValueObjectManager &manager, const Value &value,
0147 ConstString name, Module *module = nullptr);
0148
0149 ValueObjectConstResult(ExecutionContextScope *exe_scope,
0150 ValueObjectManager &manager, Status &&error);
0151
0152 ValueObject *CreateChildAtIndex(size_t idx) override {
0153 return m_impl.CreateChildAtIndex(idx);
0154 }
0155 ValueObject *CreateSyntheticArrayMember(size_t idx) override {
0156 return m_impl.CreateSyntheticArrayMember(idx);
0157 }
0158
0159 ValueObjectConstResult(const ValueObjectConstResult &) = delete;
0160 const ValueObjectConstResult &
0161 operator=(const ValueObjectConstResult &) = delete;
0162 };
0163
0164 }
0165
0166 #endif