1 //===-- ValueObjectRegister.h -----------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_ValueObjectRegister_h_
10 #define liblldb_ValueObjectRegister_h_
12 #include "lldb/Core/ValueObject.h"
13 #include "lldb/Symbol/CompilerType.h"
14 #include "lldb/Utility/ConstString.h"
15 #include "lldb/Utility/RegisterValue.h"
16 #include "lldb/lldb-defines.h"
17 #include "lldb/lldb-enumerations.h"
18 #include "lldb/lldb-forward.h"
19 #include "lldb/lldb-private-types.h"
24 namespace lldb_private {
27 class ExecutionContextScope;
31 // A ValueObject that contains a root variable that may or may not
33 class ValueObjectRegisterContext : public ValueObject {
35 ~ValueObjectRegisterContext() override;
37 uint64_t GetByteSize() override;
39 lldb::ValueType GetValueType() const override {
40 return lldb::eValueTypeRegisterSet;
43 ConstString GetTypeName() override;
45 ConstString GetQualifiedTypeName() override;
47 ConstString GetDisplayTypeName() override;
49 size_t CalculateNumChildren(uint32_t max) override;
51 ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
52 int32_t synthetic_index) override;
55 bool UpdateValue() override;
57 CompilerType GetCompilerTypeImpl() override;
59 lldb::RegisterContextSP m_reg_ctx_sp;
62 ValueObjectRegisterContext(ValueObject &parent,
63 lldb::RegisterContextSP ®_ctx_sp);
64 // For ValueObject only
65 DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext);
68 class ValueObjectRegisterSet : public ValueObject {
70 ~ValueObjectRegisterSet() override;
72 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
73 lldb::RegisterContextSP ®_ctx_sp,
76 uint64_t GetByteSize() override;
78 lldb::ValueType GetValueType() const override {
79 return lldb::eValueTypeRegisterSet;
82 ConstString GetTypeName() override;
84 ConstString GetQualifiedTypeName() override;
86 size_t CalculateNumChildren(uint32_t max) override;
88 ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
89 int32_t synthetic_index) override;
91 lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
92 bool can_create) override;
94 size_t GetIndexOfChildWithName(ConstString name) override;
97 bool UpdateValue() override;
99 CompilerType GetCompilerTypeImpl() override;
101 lldb::RegisterContextSP m_reg_ctx_sp;
102 const RegisterSet *m_reg_set;
103 uint32_t m_reg_set_idx;
106 friend class ValueObjectRegisterContext;
108 ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
109 lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx);
111 // For ValueObject only
112 DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet);
115 class ValueObjectRegister : public ValueObject {
117 ~ValueObjectRegister() override;
119 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
120 lldb::RegisterContextSP ®_ctx_sp,
123 uint64_t GetByteSize() override;
125 lldb::ValueType GetValueType() const override {
126 return lldb::eValueTypeRegister;
129 ConstString GetTypeName() override;
131 size_t CalculateNumChildren(uint32_t max) override;
133 bool SetValueFromCString(const char *value_str, Status &error) override;
135 bool SetData(DataExtractor &data, Status &error) override;
137 bool ResolveValue(Scalar &scalar) override;
140 GetExpressionPath(Stream &s, bool qualify_cxx_base_classes,
141 GetExpressionPathFormat epformat =
142 eGetExpressionPathFormatDereferencePointers) override;
145 bool UpdateValue() override;
147 CompilerType GetCompilerTypeImpl() override;
149 lldb::RegisterContextSP m_reg_ctx_sp;
150 RegisterInfo m_reg_info;
151 RegisterValue m_reg_value;
152 ConstString m_type_name;
153 CompilerType m_compiler_type;
156 void ConstructObject(uint32_t reg_num);
158 friend class ValueObjectRegisterSet;
160 ValueObjectRegister(ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp,
162 ValueObjectRegister(ExecutionContextScope *exe_scope,
163 lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num);
165 // For ValueObject only
166 DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister);
169 } // namespace lldb_private
171 #endif // liblldb_ValueObjectRegister_h_