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 <assert.h>
23 #include <stddef.h>
24 #include <stdint.h>
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() override;
36 
37  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  void SetOwningSP(lldb::ValueObjectSP &owning_sp) {
72  if (m_owning_valobj_sp == owning_sp)
73  return;
74 
75  assert(m_owning_valobj_sp.get() == nullptr);
76  m_owning_valobj_sp = owning_sp;
77  }
78 
79  bool SetValueFromCString(const char *value_str, Status &error) override;
80 
81  bool SetData(DataExtractor &data, Status &error) override;
82 
83  TypeImpl GetTypeImpl() override;
84 
85  lldb::VariableSP GetVariable() override {
86  return m_parent ? m_parent->GetVariable() : nullptr;
87  }
88 
90 
92 
93  bool IsSyntheticChildrenGenerated() override;
94 
95  void SetSyntheticChildrenGenerated(bool b) override;
96 
97  bool GetDeclaration(Declaration &decl) override;
98 
99  uint64_t GetLanguageFlags() override;
100 
101  void SetLanguageFlags(uint64_t flags) override;
102 
103 protected:
104  bool UpdateValue() override;
105 
107  return eLazyBoolYes;
108  }
109 
111  return m_use_dynamic;
112  }
113 
114  bool HasDynamicValueTypeInfo() override { return true; }
115 
117 
118  Address m_address; ///< The variable that this value object is based upon
119  TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
120  lldb::ValueObjectSP m_owning_valobj_sp;
123 
124 private:
125  friend class ValueObject;
128  lldb::DynamicValueType use_dynamic);
129 
131 };
132 
133 } // namespace lldb_private
134 
135 #endif // LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
virtual bool IsBaseClass()
Definition: ValueObject.h:391
An data extractor class.
Definition: DataExtractor.h:46
void SetOwningSP(lldb::ValueObjectSP &owning_sp)
A class that represents a running process on the host machine.
Sometimes you can find the name of the type corresponding to an object, but we don&#39;t have debug infor...
Definition: Type.h:381
DISALLOW_COPY_AND_ASSIGN(ValueObjectDynamicValue)
size_t CalculateNumChildren(uint32_t max) override
bool SetData(DataExtractor &data, Status &error) override
lldb::DynamicValueType GetDynamicValueTypeImpl() override
bool GetDeclaration(Declaration &decl) override
lldb::LanguageType GetPreferredDisplayLanguage() override
virtual ValueObject * GetParent()
Definition: ValueObject.h:735
LanguageType
Programming language type.
virtual lldb::VariableSP GetVariable()
Definition: ValueObject.h:765
void SetLanguageFlags(uint64_t flags) override
A section + offset based address class.
Definition: Address.h:59
A uniqued constant string class.
Definition: ConstString.h:40
lldb::ValueType GetValueType() const override
Represents a generic type in a programming language.
Definition: CompilerType.h:33
lldb::ValueObjectSP GetSP()
Definition: ValueObject.h:539
lldb::ValueObjectSP GetStaticValue() override
ValueObjectDynamicValue(ValueObject &parent, lldb::DynamicValueType use_dynamic)
bool SetValueFromCString(const char *value_str, Status &error) override
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24
const ValueObject * GetParent() const override
Address m_address
The variable that this value object is based upon.
An error handling class.
Definition: Status.h:44