LLDB  mainline
StoppointHitCounter.h
Go to the documentation of this file.
1 //===-- StoppointHitCounter.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_STOPPOINT_HIT_COUNTER_H
10 #define LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
11 
12 #include <cassert>
13 #include <cstdint>
14 #include <limits>
15 
17 
18 namespace lldb_private {
19 
21 public:
22  uint32_t GetValue() const { return m_hit_count; }
23 
24  void Increment(uint32_t difference = 1) {
25  lldbassert(std::numeric_limits<uint32_t>::max() - m_hit_count >= difference);
26  m_hit_count += difference;
27  }
28 
29  void Decrement(uint32_t difference = 1) {
30  lldbassert(m_hit_count >= difference);
31  m_hit_count -= difference;
32  }
33 
34  void Reset() { m_hit_count = 0; }
35 
36 private:
37  /// Number of times this breakpoint/watchpoint has been hit.
39 };
40 
41 } // namespace lldb_private
42 
43 #endif // LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
lldb_private::StoppointHitCounter::Reset
void Reset()
Definition: StoppointHitCounter.h:34
lldb_private::StoppointHitCounter::GetValue
uint32_t GetValue() const
Definition: StoppointHitCounter.h:22
lldb_private::StoppointHitCounter::Increment
void Increment(uint32_t difference=1)
Definition: StoppointHitCounter.h:24
LLDBAssert.h
lldb_private::StoppointHitCounter
Definition: StoppointHitCounter.h:20
lldb_private::StoppointHitCounter::Decrement
void Decrement(uint32_t difference=1)
Definition: StoppointHitCounter.h:29
lldbassert
#define lldbassert(x)
Definition: LLDBAssert.h:15
lldb_private::StoppointHitCounter::m_hit_count
uint32_t m_hit_count
Number of times this breakpoint/watchpoint has been hit.
Definition: StoppointHitCounter.h:38
uint32_t
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16