1 //===-- ValueObjectMemory.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_ValueObjectMemory_h_
11 #define liblldb_ValueObjectMemory_h_
12 
13 #include "lldb/Core/Address.h"
14 #include "lldb/Core/ValueObject.h"
15 #include "lldb/Symbol/CompilerType.h"
16 #include "lldb/Utility/ConstString.h"
17 #include "lldb/lldb-defines.h"
18 #include "lldb/lldb-enumerations.h"
19 #include "lldb/lldb-forward.h"
20 #include "llvm/ADT/StringRef.h"
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 namespace lldb_private {
26 class ExecutionContextScope;
27 }
28 
29 namespace lldb_private {
30 
31 //----------------------------------------------------------------------
32 // A ValueObject that represents memory at a given address, viewed as some
33 // set lldb type.
34 //----------------------------------------------------------------------
35 class ValueObjectMemory : public ValueObject {
36 public:
37   ~ValueObjectMemory() override;
38 
39   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
40                                     llvm::StringRef name,
41                                     const Address &address,
42                                     lldb::TypeSP &type_sp);
43 
44   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
45                                     llvm::StringRef name,
46                                     const Address &address,
47                                     const CompilerType &ast_type);
48 
49   uint64_t GetByteSize() override;
50 
51   ConstString GetTypeName() override;
52 
53   ConstString GetDisplayTypeName() override;
54 
55   size_t CalculateNumChildren(uint32_t max) override;
56 
57   lldb::ValueType GetValueType() const override;
58 
59   bool IsInScope() override;
60 
61   lldb::ModuleSP GetModule() override;
62 
63 protected:
64   bool UpdateValue() override;
65 
66   CompilerType GetCompilerTypeImpl() override;
67 
68   Address m_address; ///< The variable that this value object is based upon
69   lldb::TypeSP m_type_sp;
70   CompilerType m_compiler_type;
71 
72 private:
73   ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
74                     const Address &address, lldb::TypeSP &type_sp);
75 
76   ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
77                     const Address &address, const CompilerType &ast_type);
78   //------------------------------------------------------------------
79   // For ValueObject only
80   //------------------------------------------------------------------
81   DISALLOW_COPY_AND_ASSIGN(ValueObjectMemory);
82 };
83 
84 } // namespace lldb_private
85 
86 #endif // liblldb_ValueObjectMemory_h_
87