1 //===-- ValueObjectUpdater.cpp --------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Core/ValueObjectUpdater.h"
11 using namespace lldb_private
;
13 ValueObjectUpdater::ValueObjectUpdater(lldb::ValueObjectSP in_valobj_sp
) {
16 // If the user passes in a value object that is dynamic or synthetic, then
17 // water it down to the static type.
18 m_root_valobj_sp
= in_valobj_sp
->GetQualifiedRepresentationIfAvailable(
19 lldb::eNoDynamicValues
, false);
22 lldb::ValueObjectSP
ValueObjectUpdater::GetSP() {
23 lldb::ProcessSP process_sp
= GetProcessSP();
25 return lldb::ValueObjectSP();
27 const uint32_t current_stop_id
= process_sp
->GetLastNaturalStopID();
28 if (current_stop_id
== m_stop_id
)
29 return m_user_valobj_sp
;
31 m_stop_id
= current_stop_id
;
33 if (!m_root_valobj_sp
) {
34 m_user_valobj_sp
.reset();
35 return m_root_valobj_sp
;
38 m_user_valobj_sp
= m_root_valobj_sp
;
40 lldb::ValueObjectSP dynamic_sp
=
41 m_user_valobj_sp
->GetDynamicValue(lldb::eDynamicDontRunTarget
);
43 m_user_valobj_sp
= dynamic_sp
;
45 lldb::ValueObjectSP synthetic_sp
= m_user_valobj_sp
->GetSyntheticValue();
47 m_user_valobj_sp
= synthetic_sp
;
49 return m_user_valobj_sp
;
52 lldb::ProcessSP
ValueObjectUpdater::GetProcessSP() const {
54 return m_root_valobj_sp
->GetProcessSP();
55 return lldb::ProcessSP();