Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===-- StoppointSite.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_STOPPOINTSITE_H
0010 #define LLDB_BREAKPOINT_STOPPOINTSITE_H
0011 
0012 #include "lldb/Breakpoint/StoppointHitCounter.h"
0013 #include "lldb/Utility/UserID.h"
0014 #include "lldb/lldb-private.h"
0015 
0016 namespace lldb_private {
0017 
0018 class StoppointSite {
0019 public:
0020   StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
0021 
0022   StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr,
0023                 uint32_t byte_size, bool hardware);
0024 
0025   virtual ~StoppointSite() = default;
0026 
0027   virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
0028 
0029   virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
0030 
0031   uint32_t GetByteSize() const { return m_byte_size; }
0032 
0033   uint32_t GetHitCount() const { return m_hit_counter.GetValue(); }
0034 
0035   void ResetHitCount() { m_hit_counter.Reset(); }
0036 
0037   bool HardwareRequired() const { return m_is_hardware_required; }
0038 
0039   virtual bool IsHardware() const = 0;
0040 
0041   virtual bool ShouldStop(StoppointCallbackContext* context) = 0;
0042 
0043   virtual void Dump(Stream* stream) const = 0;
0044 
0045   lldb::break_id_t GetID() const { return m_id; }
0046 
0047 protected:
0048   /// Stoppoint site ID.
0049   lldb::break_id_t m_id;
0050 
0051   /// The load address of this stop point.
0052   lldb::addr_t m_addr;
0053 
0054   /// True if this point is required to use hardware (which may fail due to
0055   /// the lack of resources).
0056   bool m_is_hardware_required;
0057 
0058   /// The size in bytes of stoppoint, e.g. the length of the trap opcode for
0059   /// software breakpoints, or the optional length in bytes for hardware
0060   /// breakpoints, or the length of the watchpoint.
0061   uint32_t m_byte_size;
0062 
0063   /// Number of times this breakpoint/watchpoint has been hit.
0064   StoppointHitCounter m_hit_counter;
0065 
0066 private:
0067   StoppointSite(const StoppointSite &) = delete;
0068   const StoppointSite &operator=(const StoppointSite &) = delete;
0069   StoppointSite() = delete;
0070 };
0071 
0072 } // namespace lldb_private
0073 
0074 #endif // LLDB_BREAKPOINT_STOPPOINTSITE_H