1 //===-- StoppointHitCounter.h -----------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
10 #define LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
16 #include "lldb/Utility/LLDBAssert.h"
18 namespace lldb_private {
20 class StoppointHitCounter {
22 uint32_t GetValue() const { return m_hit_count; }
24 void Increment(uint32_t difference = 1) {
25 lldbassert(std::numeric_limits<uint32_t>::max() - m_hit_count >= difference);
26 m_hit_count += difference;
29 void Decrement(uint32_t difference = 1) {
30 lldbassert(m_hit_count >= difference);
31 m_hit_count -= difference;
34 void Reset() { m_hit_count = 0; }
37 /// Number of times this breakpoint/watchpoint has been hit.
38 uint32_t m_hit_count = 0;
41 } // namespace lldb_private
43 #endif // LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H