]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectRegister.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Core / ValueObjectRegister.h
1 //===-- ValueObjectRegister.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_ValueObjectRegister_h_
11 #define liblldb_ValueObjectRegister_h_
12
13 #include "lldb/Core/ValueObject.h"
14 #include "lldb/Symbol/CompilerType.h"
15 #include "lldb/Utility/ConstString.h"
16 #include "lldb/Utility/RegisterValue.h"
17 #include "lldb/lldb-defines.h"
18 #include "lldb/lldb-enumerations.h"
19 #include "lldb/lldb-forward.h"
20 #include "lldb/lldb-private-types.h"
21
22 #include <stddef.h>
23 #include <stdint.h>
24
25 namespace lldb_private {
26 class DataExtractor;
27 }
28 namespace lldb_private {
29 class Status;
30 }
31 namespace lldb_private {
32 class ExecutionContextScope;
33 }
34 namespace lldb_private {
35 class Scalar;
36 }
37 namespace lldb_private {
38 class Stream;
39 }
40
41 namespace lldb_private {
42
43 //----------------------------------------------------------------------
44 // A ValueObject that contains a root variable that may or may not
45 // have children.
46 //----------------------------------------------------------------------
47 class ValueObjectRegisterContext : public ValueObject {
48 public:
49   ~ValueObjectRegisterContext() override;
50
51   uint64_t GetByteSize() override;
52
53   lldb::ValueType GetValueType() const override {
54     return lldb::eValueTypeRegisterSet;
55   }
56
57   ConstString GetTypeName() override;
58
59   ConstString GetQualifiedTypeName() override;
60
61   ConstString GetDisplayTypeName() override;
62
63   size_t CalculateNumChildren(uint32_t max) override;
64
65   ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
66                                   int32_t synthetic_index) override;
67
68 protected:
69   bool UpdateValue() override;
70
71   CompilerType GetCompilerTypeImpl() override;
72
73   lldb::RegisterContextSP m_reg_ctx_sp;
74
75 private:
76   ValueObjectRegisterContext(ValueObject &parent,
77                              lldb::RegisterContextSP &reg_ctx_sp);
78   //------------------------------------------------------------------
79   // For ValueObject only
80   //------------------------------------------------------------------
81   DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext);
82 };
83
84 class ValueObjectRegisterSet : public ValueObject {
85 public:
86   ~ValueObjectRegisterSet() override;
87
88   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
89                                     lldb::RegisterContextSP &reg_ctx_sp,
90                                     uint32_t set_idx);
91
92   uint64_t GetByteSize() override;
93
94   lldb::ValueType GetValueType() const override {
95     return lldb::eValueTypeRegisterSet;
96   }
97
98   ConstString GetTypeName() override;
99
100   ConstString GetQualifiedTypeName() override;
101
102   size_t CalculateNumChildren(uint32_t max) override;
103
104   ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
105                                   int32_t synthetic_index) override;
106
107   lldb::ValueObjectSP GetChildMemberWithName(const ConstString &name,
108                                              bool can_create) override;
109
110   size_t GetIndexOfChildWithName(const ConstString &name) override;
111
112 protected:
113   bool UpdateValue() override;
114
115   CompilerType GetCompilerTypeImpl() override;
116
117   lldb::RegisterContextSP m_reg_ctx_sp;
118   const RegisterSet *m_reg_set;
119   uint32_t m_reg_set_idx;
120
121 private:
122   friend class ValueObjectRegisterContext;
123
124   ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
125                          lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx);
126
127   //------------------------------------------------------------------
128   // For ValueObject only
129   //------------------------------------------------------------------
130   DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet);
131 };
132
133 class ValueObjectRegister : public ValueObject {
134 public:
135   ~ValueObjectRegister() override;
136
137   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
138                                     lldb::RegisterContextSP &reg_ctx_sp,
139                                     uint32_t reg_num);
140
141   uint64_t GetByteSize() override;
142
143   lldb::ValueType GetValueType() const override {
144     return lldb::eValueTypeRegister;
145   }
146
147   ConstString GetTypeName() override;
148
149   size_t CalculateNumChildren(uint32_t max) override;
150
151   bool SetValueFromCString(const char *value_str, Status &error) override;
152
153   bool SetData(DataExtractor &data, Status &error) override;
154
155   bool ResolveValue(Scalar &scalar) override;
156
157   void
158   GetExpressionPath(Stream &s, bool qualify_cxx_base_classes,
159                     GetExpressionPathFormat epformat =
160                         eGetExpressionPathFormatDereferencePointers) override;
161
162 protected:
163   bool UpdateValue() override;
164
165   CompilerType GetCompilerTypeImpl() override;
166
167   lldb::RegisterContextSP m_reg_ctx_sp;
168   RegisterInfo m_reg_info;
169   RegisterValue m_reg_value;
170   ConstString m_type_name;
171   CompilerType m_compiler_type;
172
173 private:
174   void ConstructObject(uint32_t reg_num);
175
176   friend class ValueObjectRegisterSet;
177
178   ValueObjectRegister(ValueObject &parent, lldb::RegisterContextSP &reg_ctx_sp,
179                       uint32_t reg_num);
180   ValueObjectRegister(ExecutionContextScope *exe_scope,
181                       lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num);
182
183   //------------------------------------------------------------------
184   // For ValueObject only
185   //------------------------------------------------------------------
186   DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister);
187 };
188
189 } // namespace lldb_private
190
191 #endif // liblldb_ValueObjectRegister_h_