ValueObjectRegister.h revision 651cbe2e3f6efb8bd579a5007c2d2f90f0ab7633
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 ConstString 47 GetQualifiedTypeName(); 48 49 virtual uint32_t 50 CalculateNumChildren(); 51 52 virtual ValueObject * 53 CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); 54 55protected: 56 virtual bool 57 UpdateValue (); 58 59 virtual clang::ASTContext * 60 GetClangASTImpl (); 61 62 virtual lldb::clang_type_t 63 GetClangTypeImpl (); 64 65 lldb::RegisterContextSP m_reg_ctx_sp; 66 67private: 68 ValueObjectRegisterContext (ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp); 69 //------------------------------------------------------------------ 70 // For ValueObject only 71 //------------------------------------------------------------------ 72 DISALLOW_COPY_AND_ASSIGN (ValueObjectRegisterContext); 73}; 74 75class ValueObjectRegisterSet : public ValueObject 76{ 77public: 78 static lldb::ValueObjectSP 79 Create (ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx); 80 81 virtual 82 ~ValueObjectRegisterSet(); 83 84 virtual size_t 85 GetByteSize(); 86 87 virtual lldb::ValueType 88 GetValueType () const 89 { 90 return lldb::eValueTypeRegisterSet; 91 } 92 93 virtual ConstString 94 GetTypeName(); 95 96 virtual ConstString 97 GetQualifiedTypeName(); 98 99 virtual uint32_t 100 CalculateNumChildren(); 101 102 virtual ValueObject * 103 CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); 104 105 virtual lldb::ValueObjectSP 106 GetChildMemberWithName (const ConstString &name, bool can_create); 107 108 virtual uint32_t 109 GetIndexOfChildWithName (const ConstString &name); 110 111 112protected: 113 virtual bool 114 UpdateValue (); 115 116 virtual clang::ASTContext * 117 GetClangASTImpl (); 118 119 virtual lldb::clang_type_t 120 GetClangTypeImpl (); 121 122 lldb::RegisterContextSP m_reg_ctx_sp; 123 const RegisterSet *m_reg_set; 124 uint32_t m_reg_set_idx; 125 126private: 127 friend class ValueObjectRegisterContext; 128 ValueObjectRegisterSet (ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx); 129 130 //------------------------------------------------------------------ 131 // For ValueObject only 132 //------------------------------------------------------------------ 133 DISALLOW_COPY_AND_ASSIGN (ValueObjectRegisterSet); 134}; 135 136class ValueObjectRegister : public ValueObject 137{ 138public: 139 static lldb::ValueObjectSP 140 Create (ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); 141 142 virtual 143 ~ValueObjectRegister(); 144 145 virtual size_t 146 GetByteSize(); 147 148 virtual lldb::ValueType 149 GetValueType () const 150 { 151 return lldb::eValueTypeRegister; 152 } 153 154 virtual ConstString 155 GetTypeName(); 156 157 virtual uint32_t 158 CalculateNumChildren(); 159 160 virtual bool 161 SetValueFromCString (const char *value_str, Error& error); 162 163 virtual bool 164 ResolveValue (Scalar &scalar); 165 166protected: 167 virtual bool 168 UpdateValue (); 169 170 virtual clang::ASTContext * 171 GetClangASTImpl (); 172 173 virtual lldb::clang_type_t 174 GetClangTypeImpl (); 175 176 lldb::RegisterContextSP m_reg_ctx_sp; 177 RegisterInfo m_reg_info; 178 RegisterValue m_reg_value; 179 ConstString m_type_name; 180 void *m_clang_type; 181 182private: 183 void 184 ConstructObject (uint32_t reg_num); 185 186 friend class ValueObjectRegisterSet; 187 ValueObjectRegister (ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); 188 ValueObjectRegister (ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); 189 190 //------------------------------------------------------------------ 191 // For ValueObject only 192 //------------------------------------------------------------------ 193 DISALLOW_COPY_AND_ASSIGN (ValueObjectRegister); 194}; 195 196} // namespace lldb_private 197 198#endif // liblldb_ValueObjectRegister_h_ 199