1*4631afdeSRaphael Isemann //===-- ValueObjectUpdater.cpp --------------------------------------------===// 2*4631afdeSRaphael Isemann // 3*4631afdeSRaphael Isemann // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*4631afdeSRaphael Isemann // See https://llvm.org/LICENSE.txt for license information. 5*4631afdeSRaphael Isemann // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*4631afdeSRaphael Isemann // 7*4631afdeSRaphael Isemann //===----------------------------------------------------------------------===// 8*4631afdeSRaphael Isemann 9*4631afdeSRaphael Isemann #include "lldb/Core/ValueObjectUpdater.h" 10*4631afdeSRaphael Isemann 11*4631afdeSRaphael Isemann using namespace lldb_private; 12*4631afdeSRaphael Isemann ValueObjectUpdater(lldb::ValueObjectSP in_valobj_sp)13*4631afdeSRaphael IsemannValueObjectUpdater::ValueObjectUpdater(lldb::ValueObjectSP in_valobj_sp) { 14*4631afdeSRaphael Isemann if (!in_valobj_sp) 15*4631afdeSRaphael Isemann return; 16*4631afdeSRaphael Isemann // If the user passes in a value object that is dynamic or synthetic, then 17*4631afdeSRaphael Isemann // water it down to the static type. 18*4631afdeSRaphael Isemann m_root_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable( 19*4631afdeSRaphael Isemann lldb::eNoDynamicValues, false); 20*4631afdeSRaphael Isemann } 21*4631afdeSRaphael Isemann GetSP()22*4631afdeSRaphael Isemannlldb::ValueObjectSP ValueObjectUpdater::GetSP() { 23*4631afdeSRaphael Isemann lldb::ProcessSP process_sp = GetProcessSP(); 24*4631afdeSRaphael Isemann if (!process_sp) 25*4631afdeSRaphael Isemann return lldb::ValueObjectSP(); 26*4631afdeSRaphael Isemann 27*4631afdeSRaphael Isemann const uint32_t current_stop_id = process_sp->GetLastNaturalStopID(); 28*4631afdeSRaphael Isemann if (current_stop_id == m_stop_id) 29*4631afdeSRaphael Isemann return m_user_valobj_sp; 30*4631afdeSRaphael Isemann 31*4631afdeSRaphael Isemann m_stop_id = current_stop_id; 32*4631afdeSRaphael Isemann 33*4631afdeSRaphael Isemann if (!m_root_valobj_sp) { 34*4631afdeSRaphael Isemann m_user_valobj_sp.reset(); 35*4631afdeSRaphael Isemann return m_root_valobj_sp; 36*4631afdeSRaphael Isemann } 37*4631afdeSRaphael Isemann 38*4631afdeSRaphael Isemann m_user_valobj_sp = m_root_valobj_sp; 39*4631afdeSRaphael Isemann 40*4631afdeSRaphael Isemann lldb::ValueObjectSP dynamic_sp = 41*4631afdeSRaphael Isemann m_user_valobj_sp->GetDynamicValue(lldb::eDynamicDontRunTarget); 42*4631afdeSRaphael Isemann if (dynamic_sp) 43*4631afdeSRaphael Isemann m_user_valobj_sp = dynamic_sp; 44*4631afdeSRaphael Isemann 45*4631afdeSRaphael Isemann lldb::ValueObjectSP synthetic_sp = m_user_valobj_sp->GetSyntheticValue(); 46*4631afdeSRaphael Isemann if (synthetic_sp) 47*4631afdeSRaphael Isemann m_user_valobj_sp = synthetic_sp; 48*4631afdeSRaphael Isemann 49*4631afdeSRaphael Isemann return m_user_valobj_sp; 50*4631afdeSRaphael Isemann } 51*4631afdeSRaphael Isemann GetProcessSP() const52*4631afdeSRaphael Isemannlldb::ProcessSP ValueObjectUpdater::GetProcessSP() const { 53*4631afdeSRaphael Isemann if (m_root_valobj_sp) 54*4631afdeSRaphael Isemann return m_root_valobj_sp->GetProcessSP(); 55*4631afdeSRaphael Isemann return lldb::ProcessSP(); 56*4631afdeSRaphael Isemann } 57