ValueObjectConstResult.h revision 915448044bac6fdac22a33cc46697dcb771a8df2
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 // When an expression fails to evaluate, we return an error 63 static lldb::ValueObjectSP 64 Create (ExecutionContextScope *exe_scope, 65 const Error& error); 66 67 virtual ~ValueObjectConstResult(); 68 69 virtual size_t 70 GetByteSize(); 71 72 virtual clang::ASTContext * 73 GetClangAST (); 74 75 virtual lldb::clang_type_t 76 GetClangType (); 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 size_t 113 GetPointeeData (DataExtractor& data, 114 uint32_t item_idx = 0, 115 uint32_t item_count = 1); 116 117protected: 118 virtual bool 119 UpdateValue (); 120 121 // CalculateDynamicValue doesn't change the dynamic value, since this can get 122 // called at any time and you can't reliably fetch the dynamic value at any time. 123 // If we want to have dynamic values for ConstResults, then we'll need to make them 124 // up when we make the const result & stuff them in by hand. 125 virtual void 126 CalculateDynamicValue (lldb::DynamicValueType use_dynamic) {} 127 128 clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from 129 ConstString m_type_name; 130 uint32_t m_byte_size; 131 132 ValueObjectConstResultImpl m_impl; 133 134private: 135 friend class ValueObjectConstResultImpl; 136 ValueObjectConstResult (ExecutionContextScope *exe_scope, 137 lldb::ByteOrder byte_order, 138 uint32_t addr_byte_size, 139 lldb::addr_t address); 140 141 ValueObjectConstResult (ExecutionContextScope *exe_scope, 142 clang::ASTContext *clang_ast, 143 void *clang_type, 144 const ConstString &name, 145 const DataExtractor &data, 146 lldb::addr_t address); 147 148 ValueObjectConstResult (ExecutionContextScope *exe_scope, 149 clang::ASTContext *clang_ast, 150 void *clang_type, 151 const ConstString &name, 152 const lldb::DataBufferSP &result_data_sp, 153 lldb::ByteOrder byte_order, 154 uint8_t addr_size, 155 lldb::addr_t address); 156 157 ValueObjectConstResult (ExecutionContextScope *exe_scope, 158 clang::ASTContext *clang_ast, 159 void *clang_type, 160 const ConstString &name, 161 lldb::addr_t address, 162 AddressType address_type, 163 uint8_t addr_byte_size); 164 165 ValueObjectConstResult (ExecutionContextScope *exe_scope, 166 const Error& error); 167 168 DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResult); 169}; 170 171} // namespace lldb_private 172 173#endif // liblldb_ValueObjectConstResult_h_ 174