Coverage Report

Created: 2022-01-18 06:27

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Core/ValueObjectUpdater.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- ValueObjectUpdater.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
9
#include "lldb/Core/ValueObjectUpdater.h"
10
11
using namespace lldb_private;
12
13
0
ValueObjectUpdater::ValueObjectUpdater(lldb::ValueObjectSP in_valobj_sp) {
14
0
  if (!in_valobj_sp)
15
0
    return;
16
  // If the user passes in a value object that is dynamic or synthetic, then
17
  // water it down to the static type.
18
0
  m_root_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(
19
0
      lldb::eNoDynamicValues, false);
20
0
}
21
22
0
lldb::ValueObjectSP ValueObjectUpdater::GetSP() {
23
0
  lldb::ProcessSP process_sp = GetProcessSP();
24
0
  if (!process_sp)
25
0
    return lldb::ValueObjectSP();
26
27
0
  const uint32_t current_stop_id = process_sp->GetLastNaturalStopID();
28
0
  if (current_stop_id == m_stop_id)
29
0
    return m_user_valobj_sp;
30
31
0
  m_stop_id = current_stop_id;
32
33
0
  if (!m_root_valobj_sp) {
34
0
    m_user_valobj_sp.reset();
35
0
    return m_root_valobj_sp;
36
0
  }
37
38
0
  m_user_valobj_sp = m_root_valobj_sp;
39
40
0
  lldb::ValueObjectSP dynamic_sp =
41
0
      m_user_valobj_sp->GetDynamicValue(lldb::eDynamicDontRunTarget);
42
0
  if (dynamic_sp)
43
0
    m_user_valobj_sp = dynamic_sp;
44
45
0
  lldb::ValueObjectSP synthetic_sp = m_user_valobj_sp->GetSyntheticValue();
46
0
  if (synthetic_sp)
47
0
    m_user_valobj_sp = synthetic_sp;
48
49
0
  return m_user_valobj_sp;
50
0
}
51
52
0
lldb::ProcessSP ValueObjectUpdater::GetProcessSP() const {
53
0
  if (m_root_valobj_sp)
54
0
    return m_root_valobj_sp->GetProcessSP();
55
0
  return lldb::ProcessSP();
56
0
}