ValueObjectRegister.h revision fe6dc6e241c52822710380cec0931351a1d7b2d3
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 uint64_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 size_t 50 CalculateNumChildren(); 51 52 virtual ValueObject * 53 CreateChildAtIndex (size_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 uint64_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 size_t 100 CalculateNumChildren(); 101 102 virtual ValueObject * 103 CreateChildAtIndex (size_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 size_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 uint64_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 size_t 158 CalculateNumChildren(); 159 160 virtual bool 161 SetValueFromCString (const char *value_str, Error& error); 162 163 virtual bool 164 ResolveValue (Scalar &scalar); 165 166 virtual void 167 GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat epformat = eGetExpressionPathFormatDereferencePointers); 168 169protected: 170 virtual bool 171 UpdateValue (); 172 173 virtual clang::ASTContext * 174 GetClangASTImpl (); 175 176 virtual lldb::clang_type_t 177 GetClangTypeImpl (); 178 179 lldb::RegisterContextSP m_reg_ctx_sp; 180 RegisterInfo m_reg_info; 181 RegisterValue m_reg_value; 182 ConstString m_type_name; 183 void *m_clang_type; 184 185private: 186 void 187 ConstructObject (uint32_t reg_num); 188 189 friend class ValueObjectRegisterSet; 190 ValueObjectRegister (ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); 191 ValueObjectRegister (ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); 192 193 //------------------------------------------------------------------ 194 // For ValueObject only 195 //------------------------------------------------------------------ 196 DISALLOW_COPY_AND_ASSIGN (ValueObjectRegister); 197}; 198 199} // namespace lldb_private 200 201#endif // liblldb_ValueObjectRegister_h_ 202