1 //===-- StoppointLocation.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_StoppointLocation_h_
11 #define liblldb_StoppointLocation_h_
13 #include "lldb/Utility/UserID.h"
14 #include "lldb/lldb-private.h"
15 // #include "lldb/Breakpoint/BreakpointOptions.h"
17 namespace lldb_private {
19 class StoppointLocation {
21 //------------------------------------------------------------------
22 // Constructors and Destructors
23 //------------------------------------------------------------------
24 StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
26 StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr,
27 uint32_t byte_size, bool hardware);
29 virtual ~StoppointLocation();
31 //------------------------------------------------------------------
33 //------------------------------------------------------------------
35 //------------------------------------------------------------------
37 //------------------------------------------------------------------
38 virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
40 virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
42 uint32_t GetByteSize() const { return m_byte_size; }
44 uint32_t GetHitCount() const { return m_hit_count; }
46 uint32_t GetHardwareIndex() const { return m_hardware_index; }
48 bool HardwareRequired() const { return m_hardware; }
50 virtual bool IsHardware() const {
51 return m_hardware_index != LLDB_INVALID_INDEX32;
54 virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
56 virtual void Dump(Stream *stream) const {}
58 void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
60 lldb::break_id_t GetID() const { return m_loc_id; }
63 //------------------------------------------------------------------
64 // Classes that inherit from StoppointLocation can see and modify these
65 //------------------------------------------------------------------
66 lldb::break_id_t m_loc_id; // Stoppoint location ID
68 m_addr; // The load address of this stop point. The base Stoppoint doesn't
69 // store a full Address since that's not needed for the breakpoint sites.
70 bool m_hardware; // True if this point has been is required to use hardware
71 // (which may fail due to lack of resources)
72 uint32_t m_hardware_index; // The hardware resource index for this
73 // breakpoint/watchpoint
74 uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length
75 // of the trap opcode for
76 // software breakpoints, or the optional length in bytes for hardware
77 // breakpoints, or the length of the watchpoint.
79 m_hit_count; // Number of times this breakpoint/watchpoint has been hit
81 // If you override this, be sure to call the base class to increment the
83 void IncrementHitCount() { ++m_hit_count; }
85 void DecrementHitCount();
88 //------------------------------------------------------------------
89 // For StoppointLocation only
90 //------------------------------------------------------------------
91 DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
92 StoppointLocation(); // Disallow default constructor
95 } // namespace lldb_private
97 #endif // liblldb_StoppointLocation_h_