Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:43

0001 //===-- StoppointHitCounter.h -----------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
0010 #define LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
0011 
0012 #include <cassert>
0013 #include <cstdint>
0014 #include <limits>
0015 
0016 #include "lldb/Utility/LLDBAssert.h"
0017 
0018 namespace lldb_private {
0019 
0020 class StoppointHitCounter {
0021 public:
0022   uint32_t GetValue() const { return m_hit_count; }
0023 
0024   void Increment(uint32_t difference = 1) {
0025     lldbassert(std::numeric_limits<uint32_t>::max() - m_hit_count >= difference);
0026     m_hit_count += difference;
0027   }
0028 
0029   void Decrement(uint32_t difference = 1) {
0030     lldbassert(m_hit_count >= difference);
0031     m_hit_count -= difference;
0032   }
0033 
0034   void Reset() { m_hit_count = 0; }
0035 
0036 private:
0037   /// Number of times this breakpoint/watchpoint has been hit.
0038   uint32_t m_hit_count = 0;
0039 };
0040 
0041 } // namespace lldb_private
0042 
0043 #endif // LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H