Coverage Report

Created: 2023-11-11 10:31

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Breakpoint/StoppointSite.h
Line
Count
Source (jump to first uncovered line)
1
//===-- StoppointSite.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_BREAKPOINT_STOPPOINTSITE_H
10
#define LLDB_BREAKPOINT_STOPPOINTSITE_H
11
12
#include "lldb/Breakpoint/StoppointHitCounter.h"
13
#include "lldb/Utility/UserID.h"
14
#include "lldb/lldb-private.h"
15
16
namespace lldb_private {
17
18
class StoppointSite {
19
public:
20
  StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
21
22
  StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr,
23
                uint32_t byte_size, bool hardware);
24
25
32.1k
  virtual ~StoppointSite() = default;
26
27
148k
  virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
28
29
0
  virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
30
31
545
  uint32_t GetByteSize() const { return m_byte_size; }
32
33
290
  uint32_t GetHitCount() const { return m_hit_counter.GetValue(); }
34
35
60
  void ResetHitCount() { m_hit_counter.Reset(); }
36
37
35.7k
  bool HardwareRequired() const { return m_is_hardware_required; }
38
39
  virtual bool IsHardware() const = 0;
40
41
107
  uint32_t GetHardwareIndex() const { return m_hardware_index; }
42
43
227
  void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
44
45
  virtual bool ShouldStop(StoppointCallbackContext* context) = 0;
46
47
  virtual void Dump(Stream* stream) const = 0;
48
49
172k
  lldb::break_id_t GetID() const { return m_id; }
50
51
protected:
52
  /// Stoppoint site ID.
53
  lldb::break_id_t m_id;
54
55
  /// The load address of this stop point.
56
  lldb::addr_t m_addr;
57
58
  /// True if this point is required to use hardware (which may fail due to
59
  /// the lack of resources).
60
  bool m_is_hardware_required;
61
62
  /// The hardware resource index for this breakpoint/watchpoint.
63
  uint32_t m_hardware_index;
64
65
  /// The size in bytes of stoppoint, e.g. the length of the trap opcode for
66
  /// software breakpoints, or the optional length in bytes for hardware
67
  /// breakpoints, or the length of the watchpoint.
68
  uint32_t m_byte_size;
69
70
  /// Number of times this breakpoint/watchpoint has been hit.
71
  StoppointHitCounter m_hit_counter;
72
73
private:
74
  StoppointSite(const StoppointSite &) = delete;
75
  const StoppointSite &operator=(const StoppointSite &) = delete;
76
  StoppointSite() = delete;
77
};
78
79
} // namespace lldb_private
80
81
#endif // LLDB_BREAKPOINT_STOPPOINTSITE_H