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 liblldb_ValueObjectMemory_h_
10#define liblldb_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  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, llvm::StringRef name,
68                    const Address &address, lldb::TypeSP &type_sp);
69
70  ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
71                    const Address &address, const CompilerType &ast_type);
72  // For ValueObject only
73  DISALLOW_COPY_AND_ASSIGN(ValueObjectMemory);
74};
75
76} // namespace lldb_private
77
78#endif // liblldb_ValueObjectMemory_h_
79