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