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