ValueObjectConstResult.h revision 931acecd4e3af534028936431dc0f75a9fd6eb02
1//===-- ValueObjectConstResult.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_ValueObjectConstResult_h_ 11#define liblldb_ValueObjectConstResult_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/Core/ValueObject.h" 18 19#include "lldb/Core/ValueObjectConstResultImpl.h" 20 21namespace lldb_private { 22 23//---------------------------------------------------------------------- 24// A frozen ValueObject copied into host memory 25//---------------------------------------------------------------------- 26class ValueObjectConstResult : public ValueObject 27{ 28public: 29 static lldb::ValueObjectSP 30 Create (ExecutionContextScope *exe_scope, 31 lldb::ByteOrder byte_order, 32 uint32_t addr_byte_size, 33 lldb::addr_t address = LLDB_INVALID_ADDRESS); 34 35 static lldb::ValueObjectSP 36 Create (ExecutionContextScope *exe_scope, 37 clang::ASTContext *clang_ast, 38 void *clang_type, 39 const ConstString &name, 40 const DataExtractor &data, 41 lldb::addr_t address = LLDB_INVALID_ADDRESS); 42 43 static lldb::ValueObjectSP 44 Create (ExecutionContextScope *exe_scope, 45 clang::ASTContext *clang_ast, 46 void *clang_type, 47 const ConstString &name, 48 const lldb::DataBufferSP &result_data_sp, 49 lldb::ByteOrder byte_order, 50 uint8_t addr_size, 51 lldb::addr_t address = LLDB_INVALID_ADDRESS); 52 53 static lldb::ValueObjectSP 54 Create (ExecutionContextScope *exe_scope, 55 clang::ASTContext *clang_ast, 56 void *clang_type, 57 const ConstString &name, 58 lldb::addr_t address, 59 AddressType address_type, 60 uint8_t addr_byte_size); 61 62 static lldb::ValueObjectSP 63 Create (ExecutionContextScope *exe_scope, 64 clang::ASTContext *clang_ast, 65 Value &value, 66 const ConstString &name); 67 68 // When an expression fails to evaluate, we return an error 69 static lldb::ValueObjectSP 70 Create (ExecutionContextScope *exe_scope, 71 const Error& error); 72 73 virtual ~ValueObjectConstResult(); 74 75 virtual size_t 76 GetByteSize(); 77 78 virtual lldb::ValueType 79 GetValueType() const; 80 81 virtual uint32_t 82 CalculateNumChildren(); 83 84 virtual ConstString 85 GetTypeName(); 86 87 virtual bool 88 IsInScope (); 89 90 virtual bool 91 SetClangAST (clang::ASTContext *ast) 92 { 93 m_clang_ast = ast; 94 return true; 95 } 96 97 void 98 SetByteSize (size_t size); 99 100 virtual lldb::ValueObjectSP 101 Dereference (Error &error); 102 103 virtual ValueObject * 104 CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); 105 106 virtual lldb::ValueObjectSP 107 GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create); 108 109 virtual lldb::ValueObjectSP 110 AddressOf (Error &error); 111 112 virtual lldb::addr_t 113 GetAddressOf (bool scalar_is_load_address = true, 114 AddressType *address_type = NULL); 115 116 virtual size_t 117 GetPointeeData (DataExtractor& data, 118 uint32_t item_idx = 0, 119 uint32_t item_count = 1); 120 121 virtual lldb::addr_t 122 GetLiveAddress() 123 { 124 return m_impl.GetLiveAddress(); 125 } 126 127 virtual void 128 SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS, 129 AddressType address_type = eAddressTypeLoad) 130 { 131 m_impl.SetLiveAddress(addr, 132 address_type); 133 } 134 135protected: 136 virtual bool 137 UpdateValue (); 138 139 virtual clang::ASTContext * 140 GetClangASTImpl (); 141 142 virtual lldb::clang_type_t 143 GetClangTypeImpl (); 144 145 // CalculateDynamicValue doesn't change the dynamic value, since this can get 146 // called at any time and you can't reliably fetch the dynamic value at any time. 147 // If we want to have dynamic values for ConstResults, then we'll need to make them 148 // up when we make the const result & stuff them in by hand. 149 virtual void 150 CalculateDynamicValue (lldb::DynamicValueType use_dynamic) {} 151 152 clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from 153 ConstString m_type_name; 154 uint32_t m_byte_size; 155 156 ValueObjectConstResultImpl m_impl; 157 158private: 159 friend class ValueObjectConstResultImpl; 160 ValueObjectConstResult (ExecutionContextScope *exe_scope, 161 lldb::ByteOrder byte_order, 162 uint32_t addr_byte_size, 163 lldb::addr_t address); 164 165 ValueObjectConstResult (ExecutionContextScope *exe_scope, 166 clang::ASTContext *clang_ast, 167 void *clang_type, 168 const ConstString &name, 169 const DataExtractor &data, 170 lldb::addr_t address); 171 172 ValueObjectConstResult (ExecutionContextScope *exe_scope, 173 clang::ASTContext *clang_ast, 174 void *clang_type, 175 const ConstString &name, 176 const lldb::DataBufferSP &result_data_sp, 177 lldb::ByteOrder byte_order, 178 uint8_t addr_size, 179 lldb::addr_t address); 180 181 ValueObjectConstResult (ExecutionContextScope *exe_scope, 182 clang::ASTContext *clang_ast, 183 void *clang_type, 184 const ConstString &name, 185 lldb::addr_t address, 186 AddressType address_type, 187 uint8_t addr_byte_size); 188 189 ValueObjectConstResult (ExecutionContextScope *exe_scope, 190 clang::ASTContext *clang_ast, 191 const Value &value, 192 const ConstString &name); 193 194 ValueObjectConstResult (ExecutionContextScope *exe_scope, 195 const Error& error); 196 197 DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResult); 198}; 199 200} // namespace lldb_private 201 202#endif // liblldb_ValueObjectConstResult_h_ 203