/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Breakpoint/StoppointHitCounter.h
Line | Count | Source |
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 | | |
16 | | #include "lldb/Utility/LLDBAssert.h" |
17 | | |
18 | | namespace lldb_private { |
19 | | |
20 | | class StoppointHitCounter { |
21 | | public: |
22 | 1.01k | uint32_t GetValue() const { return m_hit_count; } |
23 | | |
24 | 27.6k | void Increment(uint32_t difference = 1) { |
25 | 27.6k | lldbassert(std::numeric_limits<uint32_t>::max() - m_hit_count >= difference); |
26 | 27.6k | m_hit_count += difference; |
27 | 27.6k | } |
28 | | |
29 | 237 | void Decrement(uint32_t difference = 1) { |
30 | 237 | lldbassert(m_hit_count >= difference); |
31 | 237 | m_hit_count -= difference; |
32 | 237 | } |
33 | | |
34 | 5.38k | void Reset() { m_hit_count = 0; } |
35 | | |
36 | | private: |
37 | | /// Number of times this breakpoint/watchpoint has been hit. |
38 | | uint32_t m_hit_count = 0; |
39 | | }; |
40 | | |
41 | | } // namespace lldb_private |
42 | | |
43 | | #endif // LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H |