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 liblldb_ValueObjectDynamicValue_h_
10 #define liblldb_ValueObjectDynamicValue_h_
11 
12 #include "lldb/Core/Address.h"
13 #include "lldb/Core/ValueObject.h"
15 #include "lldb/Symbol/Type.h"
18 #include "lldb/lldb-defines.h"
19 #include "lldb/lldb-enumerations.h"
20 #include "lldb/lldb-forward.h"
22 
23 #include <assert.h>
24 #include <stddef.h>
25 #include <stdint.h>
26 
27 namespace lldb_private {
28 class DataExtractor;
29 }
30 namespace lldb_private {
31 class Declaration;
32 }
33 namespace lldb_private {
34 class Status;
35 }
36 namespace lldb_private {
37 
38 // A ValueObject that represents memory at a given address, viewed as some
39 // set lldb type.
41 public:
42  ~ValueObjectDynamicValue() override;
43 
44  uint64_t GetByteSize() override;
45 
46  ConstString GetTypeName() override;
47 
49 
51 
52  size_t CalculateNumChildren(uint32_t max) override;
53 
54  lldb::ValueType GetValueType() const override;
55 
56  bool IsInScope() override;
57 
58  bool IsDynamic() override { return true; }
59 
60  bool IsBaseClass() override {
61  if (m_parent)
62  return m_parent->IsBaseClass();
63  return false;
64  }
65 
66  bool GetIsConstant() const override { return false; }
67 
68  ValueObject *GetParent() override {
69  return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
70  }
71 
72  const ValueObject *GetParent() const override {
73  return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
74  }
75 
76  lldb::ValueObjectSP GetStaticValue() override { return m_parent->GetSP(); }
77 
78  void SetOwningSP(lldb::ValueObjectSP &owning_sp) {
79  if (m_owning_valobj_sp == owning_sp)
80  return;
81 
82  assert(m_owning_valobj_sp.get() == nullptr);
83  m_owning_valobj_sp = owning_sp;
84  }
85 
86  bool SetValueFromCString(const char *value_str, Status &error) override;
87 
88  bool SetData(DataExtractor &data, Status &error) override;
89 
90  TypeImpl GetTypeImpl() override;
91 
92  lldb::VariableSP GetVariable() override {
93  return m_parent ? m_parent->GetVariable() : nullptr;
94  }
95 
97 
99 
100  bool IsSyntheticChildrenGenerated() override;
101 
102  void SetSyntheticChildrenGenerated(bool b) override;
103 
104  bool GetDeclaration(Declaration &decl) override;
105 
106  uint64_t GetLanguageFlags() override;
107 
108  void SetLanguageFlags(uint64_t flags) override;
109 
110 protected:
111  bool UpdateValue() override;
112 
114  return eLazyBoolYes;
115  }
116 
118  return m_use_dynamic;
119  }
120 
121  bool HasDynamicValueTypeInfo() override { return true; }
122 
124 
125  Address m_address; ///< The variable that this value object is based upon
126  TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
127  lldb::ValueObjectSP m_owning_valobj_sp;
130 
131 private:
132  friend class ValueObject;
135  lldb::DynamicValueType use_dynamic);
136 
137  DISALLOW_COPY_AND_ASSIGN(ValueObjectDynamicValue);
138 };
139 
140 } // namespace lldb_private
141 
142 #endif // liblldb_ValueObjectDynamicValue_h_
virtual bool IsBaseClass()
Definition: ValueObject.h:413
An data extractor class.
Definition: DataExtractor.h:47
void SetOwningSP(lldb::ValueObjectSP &owning_sp)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
Sometimes you can find the name of the type corresponding to an object, but we don&#39;t have debug infor...
Definition: Type.h:396
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:771
LanguageType
Programming language type.
virtual lldb::VariableSP GetVariable()
Definition: ValueObject.h:801
void SetLanguageFlags(uint64_t flags) override
A section + offset based address class.
Definition: Address.h:80
A uniqued constant string class.
Definition: ConstString.h:38
lldb::ValueType GetValueType() const override
lldb::ValueObjectSP GetSP()
Definition: ValueObject.h:565
lldb::ValueObjectSP GetStaticValue() override
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