mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 02:46:08 +00:00

ValueObject is part of lldbCore for historical reasons, but conceptually it deserves to be its own library. This does introduce a (link-time) circular dependency between lldbCore and lldbValueObject, which is unfortunate but probably unavoidable because so many things in LLDB rely on ValueObject. We already have cycles and these libraries are never built as dylibs so while this doesn't improve the situation, it also doesn't make things worse. The header includes were updated with the following command: ``` find . -type f -exec sed -i.bak "s%include \"lldb/Core/ValueObject%include \"lldb/ValueObject/ValueObject%" '{}' \; ```
57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
//===-- ValueObjectUpdater.cpp --------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "lldb/ValueObject/ValueObjectUpdater.h"
|
|
|
|
using namespace lldb_private;
|
|
|
|
ValueObjectUpdater::ValueObjectUpdater(lldb::ValueObjectSP in_valobj_sp) {
|
|
if (!in_valobj_sp)
|
|
return;
|
|
// If the user passes in a value object that is dynamic or synthetic, then
|
|
// water it down to the static type.
|
|
m_root_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(
|
|
lldb::eNoDynamicValues, false);
|
|
}
|
|
|
|
lldb::ValueObjectSP ValueObjectUpdater::GetSP() {
|
|
lldb::ProcessSP process_sp = GetProcessSP();
|
|
if (!process_sp)
|
|
return lldb::ValueObjectSP();
|
|
|
|
const uint32_t current_stop_id = process_sp->GetLastNaturalStopID();
|
|
if (current_stop_id == m_stop_id)
|
|
return m_user_valobj_sp;
|
|
|
|
m_stop_id = current_stop_id;
|
|
|
|
if (!m_root_valobj_sp) {
|
|
m_user_valobj_sp.reset();
|
|
return m_root_valobj_sp;
|
|
}
|
|
|
|
m_user_valobj_sp = m_root_valobj_sp;
|
|
|
|
lldb::ValueObjectSP dynamic_sp =
|
|
m_user_valobj_sp->GetDynamicValue(lldb::eDynamicDontRunTarget);
|
|
if (dynamic_sp)
|
|
m_user_valobj_sp = dynamic_sp;
|
|
|
|
lldb::ValueObjectSP synthetic_sp = m_user_valobj_sp->GetSyntheticValue();
|
|
if (synthetic_sp)
|
|
m_user_valobj_sp = synthetic_sp;
|
|
|
|
return m_user_valobj_sp;
|
|
}
|
|
|
|
lldb::ProcessSP ValueObjectUpdater::GetProcessSP() const {
|
|
if (m_root_valobj_sp)
|
|
return m_root_valobj_sp->GetProcessSP();
|
|
return lldb::ProcessSP();
|
|
}
|