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_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H
10#define LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H
11
12#include "lldb/Core/Address.h"
14#include "lldb/Symbol/Type.h"
17#include "lldb/lldb-defines.h"
19#include "lldb/lldb-forward.h"
21
22#include <cassert>
23#include <cstddef>
24#include <cstdint>
25#include <optional>
26
27namespace lldb_private {
28class DataExtractor;
29class Declaration;
30class Status;
31
32/// A ValueObject that represents memory at a given address, viewed as some
33/// set lldb type.
35public:
36 ~ValueObjectDynamicValue() override = default;
37
38 std::optional<uint64_t> GetByteSize() override;
39
40 ConstString GetTypeName() override;
41
43
45
46 llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
47
48 lldb::ValueType GetValueType() const override;
49
50 bool IsInScope() override;
51
52 bool IsDynamic() override { return true; }
53
54 bool IsBaseClass() override {
55 if (m_parent)
56 return m_parent->IsBaseClass();
57 return false;
58 }
59
60 bool GetIsConstant() const override { return false; }
61
62 ValueObject *GetParent() override {
63 return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
64 }
65
66 const ValueObject *GetParent() const override {
67 return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
68 }
69
71
72 bool SetValueFromCString(const char *value_str, Status &error) override;
73
74 bool SetData(DataExtractor &data, Status &error) override;
75
76 TypeImpl GetTypeImpl() override;
77
79 return m_parent ? m_parent->GetVariable() : nullptr;
80 }
81
83
85
86 bool IsSyntheticChildrenGenerated() override;
87
88 void SetSyntheticChildrenGenerated(bool b) override;
89
90 bool GetDeclaration(Declaration &decl) override;
91
92 uint64_t GetLanguageFlags() override;
93
94 void SetLanguageFlags(uint64_t flags) override;
95
96protected:
97 bool UpdateValue() override;
98
100 return eLazyBoolYes;
101 }
102
104 return m_use_dynamic;
105 }
106
107 bool HasDynamicValueTypeInfo() override { return true; }
108
110
111 Address m_address; ///< The variable that this value object is based upon
112 TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
115
116private:
117 friend class ValueObject;
120 lldb::DynamicValueType use_dynamic);
121
125};
126
127} // namespace lldb_private
128
129#endif // LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
Definition: Address.h:62
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
A uniqued constant string class.
Definition: ConstString.h:40
An data extractor class.
Definition: DataExtractor.h:48
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24
An error handling class.
Definition: Status.h:115
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:779
A frozen ValueObject copied into host memory.
A ValueObject that represents memory at a given address, viewed as some set lldb type.
const ValueObject * GetParent() const override
ValueObjectDynamicValue(const ValueObjectDynamicValue &)=delete
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
lldb::ValueType GetValueType() const override
lldb::LanguageType GetPreferredDisplayLanguage() override
void SetLanguageFlags(uint64_t flags) override
lldb::ValueObjectSP GetStaticValue() override
const ValueObjectDynamicValue & operator=(const ValueObjectDynamicValue &)=delete
lldb::DynamicValueType GetDynamicValueTypeImpl() override
bool SetData(DataExtractor &data, Status &error) override
bool GetDeclaration(Declaration &decl) override
~ValueObjectDynamicValue() override=default
bool SetValueFromCString(const char *value_str, Status &error) override
std::optional< uint64_t > GetByteSize() override
Address m_address
The variable that this value object is based upon.
lldb::ValueObjectSP GetSP()
Definition: ValueObject.h:569
virtual lldb::VariableSP GetVariable()
Definition: ValueObject.h:860
ValueObject * m_parent
The parent value object, or nullptr if this has no parent.
Definition: ValueObject.h:915
virtual bool IsBaseClass()
Definition: ValueObject.h:398
virtual ValueObject * GetParent()
Definition: ValueObject.h:828
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:484
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Variable > VariableSP
Definition: lldb-forward.h:486