1 //===-- ValueObjectMemory.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_VALUEOBJECTMEMORY_H 10 #define LLDB_CORE_VALUEOBJECTMEMORY_H 11 12 #include "lldb/Core/Address.h" 13 #include "lldb/Core/ValueObject.h" 14 #include "lldb/Symbol/CompilerType.h" 15 #include "lldb/Utility/ConstString.h" 16 #include "lldb/lldb-defines.h" 17 #include "lldb/lldb-enumerations.h" 18 #include "lldb/lldb-forward.h" 19 #include "llvm/ADT/StringRef.h" 20 21 #include <cstddef> 22 #include <cstdint> 23 #include <optional> 24 25 namespace lldb_private { 26 class ExecutionContextScope; 27 28 /// A ValueObject that represents memory at a given address, viewed as some 29 /// set lldb type. 30 class ValueObjectMemory : public ValueObject { 31 public: 32 ~ValueObjectMemory() override; 33 34 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, 35 llvm::StringRef name, 36 const Address &address, 37 lldb::TypeSP &type_sp); 38 39 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, 40 llvm::StringRef name, 41 const Address &address, 42 const CompilerType &ast_type); 43 44 std::optional<uint64_t> GetByteSize() override; 45 46 ConstString GetTypeName() override; 47 48 ConstString GetDisplayTypeName() override; 49 50 llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override; 51 52 lldb::ValueType GetValueType() const override; 53 54 bool IsInScope() override; 55 56 lldb::ModuleSP GetModule() override; 57 58 protected: 59 bool UpdateValue() override; 60 61 CompilerType GetCompilerTypeImpl() override; 62 63 Address m_address; ///< The variable that this value object is based upon 64 lldb::TypeSP m_type_sp; 65 CompilerType m_compiler_type; 66 67 private: 68 ValueObjectMemory(ExecutionContextScope *exe_scope, 69 ValueObjectManager &manager, llvm::StringRef name, 70 const Address &address, lldb::TypeSP &type_sp); 71 72 ValueObjectMemory(ExecutionContextScope *exe_scope, 73 ValueObjectManager &manager, llvm::StringRef name, 74 const Address &address, const CompilerType &ast_type); 75 // For ValueObject only 76 ValueObjectMemory(const ValueObjectMemory &) = delete; 77 const ValueObjectMemory &operator=(const ValueObjectMemory &) = delete; 78 }; 79 80 } // namespace lldb_private 81 82 #endif // LLDB_CORE_VALUEOBJECTMEMORY_H 83