Coverage Report

Created: 2022-01-22 13:19

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Core/ValueObjectRegister.h
Line
Count
Source (jump to first uncovered line)
1
//===-- ValueObjectRegister.h -----------------------------------*- C++ -*-===//
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
#ifndef LLDB_CORE_VALUEOBJECTREGISTER_H
10
#define LLDB_CORE_VALUEOBJECTREGISTER_H
11
12
#include "lldb/Core/ValueObject.h"
13
#include "lldb/Symbol/CompilerType.h"
14
#include "lldb/Utility/ConstString.h"
15
#include "lldb/Utility/RegisterValue.h"
16
#include "lldb/lldb-defines.h"
17
#include "lldb/lldb-enumerations.h"
18
#include "lldb/lldb-forward.h"
19
#include "lldb/lldb-private-types.h"
20
21
#include <cstddef>
22
#include <cstdint>
23
24
namespace lldb_private {
25
class DataExtractor;
26
class Status;
27
class ExecutionContextScope;
28
class Scalar;
29
class Stream;
30
31
class ValueObjectRegisterSet : public ValueObject {
32
public:
33
  ~ValueObjectRegisterSet() override;
34
35
  static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
36
                                    lldb::RegisterContextSP &reg_ctx_sp,
37
                                    uint32_t set_idx);
38
39
  llvm::Optional<uint64_t> GetByteSize() override;
40
41
0
  lldb::ValueType GetValueType() const override {
42
0
    return lldb::eValueTypeRegisterSet;
43
0
  }
44
45
  ConstString GetTypeName() override;
46
47
  ConstString GetQualifiedTypeName() override;
48
49
  size_t CalculateNumChildren(uint32_t max) override;
50
51
  ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
52
                                  int32_t synthetic_index) override;
53
54
  lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
55
                                             bool can_create) override;
56
57
  size_t GetIndexOfChildWithName(ConstString name) override;
58
59
protected:
60
  bool UpdateValue() override;
61
62
  CompilerType GetCompilerTypeImpl() override;
63
64
  lldb::RegisterContextSP m_reg_ctx_sp;
65
  const RegisterSet *m_reg_set;
66
  uint32_t m_reg_set_idx;
67
68
private:
69
  friend class ValueObjectRegisterContext;
70
71
  ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
72
                         ValueObjectManager &manager,
73
                         lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx);
74
75
  // For ValueObject only
76
  ValueObjectRegisterSet(const ValueObjectRegisterSet &) = delete;
77
  const ValueObjectRegisterSet &
78
  operator=(const ValueObjectRegisterSet &) = delete;
79
};
80
81
class ValueObjectRegister : public ValueObject {
82
public:
83
  ~ValueObjectRegister() override;
84
85
  static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
86
                                    lldb::RegisterContextSP &reg_ctx_sp,
87
                                    const RegisterInfo *reg_info);
88
89
  llvm::Optional<uint64_t> GetByteSize() override;
90
91
0
  lldb::ValueType GetValueType() const override {
92
0
    return lldb::eValueTypeRegister;
93
0
  }
94
95
  ConstString GetTypeName() override;
96
97
  size_t CalculateNumChildren(uint32_t max) override;
98
99
  bool SetValueFromCString(const char *value_str, Status &error) override;
100
101
  bool SetData(DataExtractor &data, Status &error) override;
102
103
  bool ResolveValue(Scalar &scalar) override;
104
105
  void
106
  GetExpressionPath(Stream &s,
107
                    GetExpressionPathFormat epformat =
108
                        eGetExpressionPathFormatDereferencePointers) override;
109
110
protected:
111
  bool UpdateValue() override;
112
113
  CompilerType GetCompilerTypeImpl() override;
114
115
  lldb::RegisterContextSP m_reg_ctx_sp;
116
  RegisterInfo m_reg_info;
117
  RegisterValue m_reg_value;
118
  ConstString m_type_name;
119
  CompilerType m_compiler_type;
120
121
private:
122
  void ConstructObject(const RegisterInfo *reg_info);
123
124
  friend class ValueObjectRegisterSet;
125
126
  ValueObjectRegister(ValueObject &parent, lldb::RegisterContextSP &reg_ctx_sp,
127
                      const RegisterInfo *reg_info);
128
  ValueObjectRegister(ExecutionContextScope *exe_scope,
129
                      ValueObjectManager &manager,
130
                      lldb::RegisterContextSP &reg_ctx_sp,
131
                      const RegisterInfo *reg_info);
132
133
  // For ValueObject only
134
  ValueObjectRegister(const ValueObjectRegister &) = delete;
135
  const ValueObjectRegister &operator=(const ValueObjectRegister &) = delete;
136
};
137
138
} // namespace lldb_private
139
140
#endif // LLDB_CORE_VALUEOBJECTREGISTER_H