1 //===-- ValueObjectVariable.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_ValueObjectVariable_h_ 11 #define liblldb_ValueObjectVariable_h_ 12 13 #include "lldb/Core/ValueObject.h" 14 15 #include "lldb/Core/Value.h" 16 #include "lldb/Symbol/CompilerType.h" 17 #include "lldb/Utility/ConstString.h" 18 #include "lldb/lldb-defines.h" 19 #include "lldb/lldb-enumerations.h" 20 #include "lldb/lldb-forward.h" 21 22 #include <stddef.h> 23 #include <stdint.h> 24 25 namespace lldb_private { 26 class DataExtractor; 27 } 28 namespace lldb_private { 29 class Declaration; 30 } 31 namespace lldb_private { 32 class Status; 33 } 34 namespace lldb_private { 35 class ExecutionContextScope; 36 } 37 namespace lldb_private { 38 class SymbolContextScope; 39 } 40 41 namespace lldb_private { 42 43 //---------------------------------------------------------------------- 44 // A ValueObject that contains a root variable that may or may not 45 // have children. 46 //---------------------------------------------------------------------- 47 class ValueObjectVariable : public ValueObject { 48 public: 49 ~ValueObjectVariable() override; 50 51 static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, 52 const lldb::VariableSP &var_sp); 53 54 uint64_t GetByteSize() override; 55 56 ConstString GetTypeName() override; 57 58 ConstString GetQualifiedTypeName() override; 59 60 ConstString GetDisplayTypeName() override; 61 62 size_t CalculateNumChildren(uint32_t max) override; 63 64 lldb::ValueType GetValueType() const override; 65 66 bool IsInScope() override; 67 68 lldb::ModuleSP GetModule() override; 69 70 SymbolContextScope *GetSymbolContextScope() override; 71 72 bool GetDeclaration(Declaration &decl) override; 73 74 const char *GetLocationAsCString() override; 75 76 bool SetValueFromCString(const char *value_str, Status &error) override; 77 78 bool SetData(DataExtractor &data, Status &error) override; 79 GetVariable()80 virtual lldb::VariableSP GetVariable() override { return m_variable_sp; } 81 82 protected: 83 bool UpdateValue() override; 84 85 CompilerType GetCompilerTypeImpl() override; 86 87 lldb::VariableSP 88 m_variable_sp; ///< The variable that this value object is based upon 89 Value m_resolved_value; ///< The value that DWARFExpression resolves this 90 ///variable to before we patch it up 91 92 private: 93 ValueObjectVariable(ExecutionContextScope *exe_scope, 94 const lldb::VariableSP &var_sp); 95 //------------------------------------------------------------------ 96 // For ValueObject only 97 //------------------------------------------------------------------ 98 DISALLOW_COPY_AND_ASSIGN(ValueObjectVariable); 99 }; 100 101 } // namespace lldb_private 102 103 #endif // liblldb_ValueObjectVariable_h_ 104