LLDB  mainline
ValueObjectVariable.h
Go to the documentation of this file.
1 //===-- ValueObjectVariable.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_VALUEOBJECTVARIABLE_H
10 #define LLDB_CORE_VALUEOBJECTVARIABLE_H
11 
12 #include "lldb/Core/ValueObject.h"
13 
14 #include "lldb/Core/Value.h"
17 #include "lldb/lldb-defines.h"
18 #include "lldb/lldb-enumerations.h"
19 #include "lldb/lldb-forward.h"
20 
21 #include <cstddef>
22 #include <cstdint>
23 
24 namespace lldb_private {
25 class DataExtractor;
26 class Declaration;
27 class Status;
28 class ExecutionContextScope;
29 class SymbolContextScope;
30 
31 /// A ValueObject that contains a root variable that may or may not
32 /// have children.
34 public:
35  ~ValueObjectVariable() override;
36 
37  static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
38  const lldb::VariableSP &var_sp);
39 
40  llvm::Optional<uint64_t> GetByteSize() override;
41 
42  ConstString GetTypeName() override;
43 
45 
47 
48  size_t CalculateNumChildren(uint32_t max) override;
49 
50  lldb::ValueType GetValueType() const override;
51 
52  bool IsInScope() override;
53 
54  lldb::ModuleSP GetModule() override;
55 
57 
58  bool GetDeclaration(Declaration &decl) override;
59 
60  const char *GetLocationAsCString() override;
61 
62  bool SetValueFromCString(const char *value_str, Status &error) override;
63 
64  bool SetData(DataExtractor &data, Status &error) override;
65 
66  lldb::VariableSP GetVariable() override { return m_variable_sp; }
67 
68 protected:
69  bool UpdateValue() override;
70 
71  void DoUpdateChildrenAddressType(ValueObject &valobj) override;
72 
74 
75  /// The variable that this value object is based upon.
76  lldb::VariableSP m_variable_sp;
77  ///< The value that DWARFExpression resolves this variable to before we patch
78  ///< it up.
80 
81 private:
83  ValueObjectManager &manager,
84  const lldb::VariableSP &var_sp);
85  // For ValueObject only
86  ValueObjectVariable(const ValueObjectVariable &) = delete;
87  const ValueObjectVariable &operator=(const ValueObjectVariable &) = delete;
88 };
89 
90 } // namespace lldb_private
91 
92 #endif // LLDB_CORE_VALUEOBJECTVARIABLE_H
lldb_private::Value
Definition: Value.h:38
lldb-defines.h
lldb_private::ValueObjectVariable::GetModule
lldb::ModuleSP GetModule() override
Return the module associated with this value object in case the value is from an executable file and ...
Definition: ValueObjectVariable.cpp:326
lldb_private::ValueObjectVariable::GetDisplayTypeName
ConstString GetDisplayTypeName() override
Definition: ValueObjectVariable.cpp:82
lldb_private::ClusterManager
Definition: SharedCluster.h:22
lldb_private::ValueObjectVariable::CalculateNumChildren
size_t CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
Definition: ValueObjectVariable.cpp:96
lldb_private::ValueObjectVariable::GetDeclaration
bool GetDeclaration(Declaration &decl) override
Definition: ValueObjectVariable.cpp:342
lldb_private::ValueObjectVariable::GetTypeName
ConstString GetTypeName() override
Definition: ValueObjectVariable.cpp:75
lldb_private::ValueObjectVariable::GetValueType
lldb::ValueType GetValueType() const override
Definition: ValueObjectVariable.cpp:119
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::ValueObjectVariable::GetCompilerTypeImpl
CompilerType GetCompilerTypeImpl() override
Definition: ValueObjectVariable.cpp:68
lldb_private::ValueObjectVariable::~ValueObjectVariable
~ValueObjectVariable() override
lldb_private::ValueObjectVariable::ValueObjectVariable
ValueObjectVariable(ExecutionContextScope *exe_scope, ValueObjectManager &manager, const lldb::VariableSP &var_sp)
Definition: ValueObjectVariable.cpp:57
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::ValueObjectVariable::GetVariable
lldb::VariableSP GetVariable() override
Definition: ValueObjectVariable.h:66
lldb-enumerations.h
lldb_private::ValueObjectVariable::operator=
const ValueObjectVariable & operator=(const ValueObjectVariable &)=delete
lldb_private::ValueObjectVariable::m_variable_sp
lldb::VariableSP m_variable_sp
The variable that this value object is based upon.
Definition: ValueObjectVariable.h:76
lldb_private::ValueObjectVariable::GetQualifiedTypeName
ConstString GetQualifiedTypeName() override
Definition: ValueObjectVariable.cpp:89
CompilerType.h
ValueObject.h
lldb_private::SymbolContextScope
Definition: SymbolContextScope.h:64
lldb_private::ValueObjectVariable::m_resolved_value
Value m_resolved_value
Definition: ValueObjectVariable.h:79
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::ValueObjectVariable::SetValueFromCString
bool SetValueFromCString(const char *value_str, Status &error) override
Definition: ValueObjectVariable.cpp:357
lldb_private::ValueObjectVariable::SetData
bool SetData(DataExtractor &data, Status &error) override
Definition: ValueObjectVariable.cpp:387
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb-forward.h
lldb_private::ValueObjectVariable::DoUpdateChildrenAddressType
void DoUpdateChildrenAddressType(ValueObject &valobj) override
Definition: ValueObjectVariable.cpp:253
lldb_private::ValueObjectVariable::GetSymbolContextScope
SymbolContextScope * GetSymbolContextScope() override
Definition: ValueObjectVariable.cpp:336
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ValueObjectVariable::IsInScope
bool IsInScope() override
Definition: ValueObjectVariable.cpp:308
ConstString.h
lldb_private::ValueObjectVariable::GetByteSize
llvm::Optional< uint64_t > GetByteSize() override
Definition: ValueObjectVariable.cpp:108
lldb_private::ValueObjectVariable::Create
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
Definition: ValueObjectVariable.cpp:51
lldb_private::Declaration
Definition: Declaration.h:24
lldb_private::LineStatus::Status
@ Status
lldb_private::ValueObjectVariable::UpdateValue
bool UpdateValue() override
Definition: ValueObjectVariable.cpp:125
Value.h
lldb_private::ValueObjectVariable
A ValueObject that contains a root variable that may or may not have children.
Definition: ValueObjectVariable.h:33
lldb_private::ValueObjectVariable::GetLocationAsCString
const char * GetLocationAsCString() override
Definition: ValueObjectVariable.cpp:350