LLDB  mainline
ValueObjectDynamicValue.h
Go to the documentation of this file.
1 //===-- ValueObjectDynamicValue.h -------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
10 #define LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
11 
12 #include "lldb/Core/Address.h"
13 #include "lldb/Core/ValueObject.h"
15 #include "lldb/Symbol/Type.h"
17 #include "lldb/lldb-defines.h"
18 #include "lldb/lldb-enumerations.h"
19 #include "lldb/lldb-forward.h"
21 
22 #include <cassert>
23 #include <cstddef>
24 #include <cstdint>
25 
26 namespace lldb_private {
27 class DataExtractor;
28 class Declaration;
29 class Status;
30 
31 /// A ValueObject that represents memory at a given address, viewed as some
32 /// set lldb type.
34 public:
35  ~ValueObjectDynamicValue() = default;
36 
37  llvm::Optional<uint64_t> GetByteSize() override;
38 
39  ConstString GetTypeName() override;
40 
42 
44 
45  size_t CalculateNumChildren(uint32_t max) override;
46 
47  lldb::ValueType GetValueType() const override;
48 
49  bool IsInScope() override;
50 
51  bool IsDynamic() override { return true; }
52 
53  bool IsBaseClass() override {
54  if (m_parent)
55  return m_parent->IsBaseClass();
56  return false;
57  }
58 
59  bool GetIsConstant() const override { return false; }
60 
61  ValueObject *GetParent() override {
62  return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
63  }
64 
65  const ValueObject *GetParent() const override {
66  return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
67  }
68 
69  lldb::ValueObjectSP GetStaticValue() override { return m_parent->GetSP(); }
70 
71  bool SetValueFromCString(const char *value_str, Status &error) override;
72 
73  bool SetData(DataExtractor &data, Status &error) override;
74 
75  TypeImpl GetTypeImpl() override;
76 
77  lldb::VariableSP GetVariable() override {
78  return m_parent ? m_parent->GetVariable() : nullptr;
79  }
80 
82 
84 
85  bool IsSyntheticChildrenGenerated() override;
86 
87  void SetSyntheticChildrenGenerated(bool b) override;
88 
89  bool GetDeclaration(Declaration &decl) override;
90 
91  uint64_t GetLanguageFlags() override;
92 
93  void SetLanguageFlags(uint64_t flags) override;
94 
95 protected:
96  bool UpdateValue() override;
97 
99  return eLazyBoolYes;
100  }
101 
103  return m_use_dynamic;
104  }
105 
106  bool HasDynamicValueTypeInfo() override { return true; }
107 
109 
110  Address m_address; ///< The variable that this value object is based upon
111  TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
114 
115 private:
116  friend class ValueObject;
119  lldb::DynamicValueType use_dynamic);
120 
123  operator=(const ValueObjectDynamicValue &) = delete;
124 };
125 
126 } // namespace lldb_private
127 
128 #endif // LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
lldb_private::ValueObjectDynamicValue::GetCompilerTypeImpl
CompilerType GetCompilerTypeImpl() override
Definition: ValueObjectDynamicValue.cpp:39
lldb_private::ValueObjectDynamicValue::GetParent
ValueObject * GetParent() override
Definition: ValueObjectDynamicValue.h:61
lldb_private::ValueObjectDynamicValue::GetByteSize
llvm::Optional< uint64_t > GetByteSize() override
Definition: ValueObjectDynamicValue.cpp:97
lldb_private::ValueObjectDynamicValue::UpdateValue
bool UpdateValue() override
Definition: ValueObjectDynamicValue.cpp:110
lldb_private::ValueObjectDynamicValue::GetLanguageFlags
uint64_t GetLanguageFlags() override
Definition: ValueObjectDynamicValue.cpp:373
lldb-defines.h
lldb_private::ValueObjectDynamicValue::GetDynamicValueTypeImpl
lldb::DynamicValueType GetDynamicValueTypeImpl() override
Definition: ValueObjectDynamicValue.h:102
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
lldb_private::ValueObjectDynamicValue::GetQualifiedTypeName
ConstString GetQualifiedTypeName() override
Definition: ValueObjectDynamicValue.cpp:67
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::ValueObjectDynamicValue::HasDynamicValueTypeInfo
bool HasDynamicValueTypeInfo() override
Definition: ValueObjectDynamicValue.h:106
lldb_private::ValueObjectDynamicValue
A ValueObject that represents memory at a given address, viewed as some set lldb type.
Definition: ValueObjectDynamicValue.h:33
lldb_private::ValueObjectDynamicValue::m_use_dynamic
lldb::DynamicValueType m_use_dynamic
Definition: ValueObjectDynamicValue.h:112
lldb_private::ValueObjectDynamicValue::GetPreferredDisplayLanguage
lldb::LanguageType GetPreferredDisplayLanguage() override
Definition: ValueObjectDynamicValue.cpp:345
lldb_private::ValueObjectDynamicValue::IsDynamic
bool IsDynamic() override
Definition: ValueObjectDynamicValue.h:51
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb-private-enumerations.h
lldb_private::ValueObjectDynamicValue::m_dynamic_type_info
TypeAndOrName m_dynamic_type_info
Definition: ValueObjectDynamicValue.h:111
lldb_private::ValueObjectDynamicValue::SetSyntheticChildrenGenerated
void SetSyntheticChildrenGenerated(bool b) override
Definition: ValueObjectDynamicValue.cpp:360
lldb_private::ValueObjectDynamicValue::GetStaticValue
lldb::ValueObjectSP GetStaticValue() override
Definition: ValueObjectDynamicValue.h:69
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ValueObjectDynamicValue::GetVariable
lldb::VariableSP GetVariable() override
Definition: ValueObjectDynamicValue.h:77
lldb_private::ValueObjectDynamicValue::ValueObjectDynamicValue
ValueObjectDynamicValue(ValueObject &parent, lldb::DynamicValueType use_dynamic)
Definition: ValueObjectDynamicValue.cpp:32
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ValueObject::IsBaseClass
virtual bool IsBaseClass()
Definition: ValueObject.h:398
lldb_private::ValueObject::GetSP
lldb::ValueObjectSP GetSP()
Definition: ValueObject.h:555
lldb_private::ValueObjectDynamicValue::SetData
bool SetData(DataExtractor &data, Status &error) override
Definition: ValueObjectDynamicValue.cpp:303
Type.h
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::ValueObjectDynamicValue::m_type_impl
TypeImpl m_type_impl
Definition: ValueObjectDynamicValue.h:113
lldb-enumerations.h
lldb_private::ValueObjectDynamicValue::IsInScope
bool IsInScope() override
Definition: ValueObjectDynamicValue.cpp:267
lldb_private::ValueObjectDynamicValue::GetIsConstant
bool GetIsConstant() const override
Definition: ValueObjectDynamicValue.h:59
lldb_private::ValueObject::GetParent
virtual ValueObject * GetParent()
Definition: ValueObject.h:753
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
CompilerType.h
Address.h
lldb_private::ValueObjectDynamicValue::operator=
const ValueObjectDynamicValue & operator=(const ValueObjectDynamicValue &)=delete
lldb_private::ValueObjectDynamicValue::IsBaseClass
bool IsBaseClass() override
Definition: ValueObjectDynamicValue.h:53
ValueObject.h
lldb_private::ValueObjectDynamicValue::GetTypeImpl
TypeImpl GetTypeImpl() override
Definition: ValueObjectDynamicValue.cpp:59
lldb_private::ValueObjectDynamicValue::GetDisplayTypeName
ConstString GetDisplayTypeName() override
Definition: ValueObjectDynamicValue.cpp:76
lldb_private::ValueObjectDynamicValue::GetTypeName
ConstString GetTypeName() override
Definition: ValueObjectDynamicValue.cpp:50
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb::ValueType
ValueType
Definition: lldb-enumerations.h:315
uint32_t
lldb_private::Address
Definition: Address.h:59
lldb_private::ValueObject::m_parent
ValueObject * m_parent
The parent value object, or nullptr if this has no parent.
Definition: ValueObject.h:840
lldb_private::ValueObjectDynamicValue::SetPreferredDisplayLanguage
void SetPreferredDisplayLanguage(lldb::LanguageType)
Definition: ValueObjectDynamicValue.cpp:338
lldb_private::ValueObjectDynamicValue::IsSyntheticChildrenGenerated
bool IsSyntheticChildrenGenerated() override
Definition: ValueObjectDynamicValue.cpp:354
lldb_private::ValueObjectConstResult
A frozen ValueObject copied into host memory.
Definition: ValueObjectConstResult.h:33
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::ValueObjectDynamicValue::SetValueFromCString
bool SetValueFromCString(const char *value_str, Status &error) override
Definition: ValueObjectDynamicValue.cpp:269
lldb-forward.h
lldb_private::ValueObject::GetVariable
virtual lldb::VariableSP GetVariable()
Definition: ValueObject.h:785
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TypeImpl
Definition: Type.h:238
lldb_private::ValueObjectDynamicValue::GetDeclaration
bool GetDeclaration(Declaration &decl) override
Definition: ValueObjectDynamicValue.cpp:366
ConstString.h
lldb_private::ValueObjectDynamicValue::m_address
Address m_address
The variable that this value object is based upon.
Definition: ValueObjectDynamicValue.h:110
lldb_private::TypeAndOrName
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:394
lldb_private::ValueObjectDynamicValue::GetParent
const ValueObject * GetParent() const override
Definition: ValueObjectDynamicValue.h:65
lldb_private::Declaration
Definition: Declaration.h:24
lldb_private::LineStatus::Status
@ Status
lldb_private::ValueObjectDynamicValue::CanUpdateWithInvalidExecutionContext
LazyBool CanUpdateWithInvalidExecutionContext() override
Definition: ValueObjectDynamicValue.h:98
lldb_private::ValueObjectDynamicValue::GetValueType
lldb::ValueType GetValueType() const override
Definition: ValueObjectDynamicValue.cpp:106
lldb_private::ValueObjectDynamicValue::~ValueObjectDynamicValue
~ValueObjectDynamicValue()=default
lldb_private::ValueObjectDynamicValue::CalculateNumChildren
size_t CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
Definition: ValueObjectDynamicValue.cpp:87
lldb_private::ValueObjectDynamicValue::SetLanguageFlags
void SetLanguageFlags(uint64_t flags) override
Definition: ValueObjectDynamicValue.cpp:379