LLDB mainline
ValueObjectSynthesizedValue.cpp
Go to the documentation of this file.
1//===-- ValueObjectSynthesizedValue.cpp -----------------------------------===//
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
10
12#include "lldb/Utility/Status.h"
13
14using namespace lldb;
15using namespace lldb_private;
16
18 lldb::ValueType type) {
20 auto manager_sp = ValueObjectManager::Create();
22 exe_ctx.GetBestExecutionContextScope(), *manager_sp,
23 valobj.GetSP(), type))
24 ->GetSP();
25}
26
28 ExecutionContextScope *exe_scope, ValueObjectManager &manager,
29 const lldb::ValueObjectSP &valobj_sp, lldb::ValueType type)
30 : ValueObject(exe_scope, manager), m_valobj_sp(valobj_sp), m_type(type) {
31 SetName(valobj_sp->GetName());
32}
33
35
36llvm::Expected<uint64_t> ValueObjectSynthesizedValue::GetByteSize() {
37 return m_valobj_sp->GetByteSize();
38}
39
40llvm::Expected<uint32_t>
42 return m_valobj_sp->GetNumChildren(max);
43}
44
46 return m_valobj_sp->IsInScope();
47}
48
52
54 SetValueIsValid(false);
55 m_error.Clear();
56
57 if (!m_valobj_sp->UpdateValueIfNeeded(false)) {
58 if (m_error.Success() && m_valobj_sp->GetError().Fail())
59 m_error = m_valobj_sp->GetError().Clone();
60 return false;
61 }
62
63 m_update_point.SetUpdated();
64 m_value = m_valobj_sp->GetValue();
65 SetAddressTypeOfChildren(m_valobj_sp->GetAddressTypeOfChildren());
67 m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
68 SetValueDidChange(m_valobj_sp->GetValueDidChange());
69 SetValueIsValid(m_error.Success());
70 return m_error.Success();
71}
static std::shared_ptr< ClusterManager > Create()
Generic representation of a type in a programming language.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
llvm::Expected< uint64_t > GetByteSize() override
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
ValueObjectSynthesizedValue(ExecutionContextScope *exe_scope, ValueObjectManager &manager, const lldb::ValueObjectSP &valobj_sp, lldb::ValueType type)
static lldb::ValueObjectSP Create(ValueObject &valobj, lldb::ValueType type)
void SetValueIsValid(bool valid)
EvaluationPoint m_update_point
Stores both the stop id and the full context at which this value was last updated.
ClusterManager< ValueObject > ValueObjectManager
ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager, AddressType child_ptr_or_ref_addr_type=eAddressTypeLoad)
Use this constructor to create a "root variable object".
lldb::ValueObjectSP GetSP()
Status m_error
An error object that can describe any errors that occur when updating values.
DataExtractor m_data
A data extractor that can be used to extract the value.
void SetValueDidChange(bool value_changed)
virtual lldb::ModuleSP GetModule()
Return the module associated with this value object in case the value is from an executable file and ...
void SetName(llvm::StringRef name)
Change the name of the current ValueObject.
const ExecutionContextRef & GetExecutionContextRef() const
void SetAddressTypeOfChildren(AddressType at)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP