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_
15 // Other libraries and framework includes
17 #include "lldb/Utility/UserID.h"
18 #include "lldb/lldb-private.h"
19 // #include "lldb/Breakpoint/BreakpointOptions.h"
21 namespace lldb_private {
23 class StoppointLocation {
25 //------------------------------------------------------------------
26 // Constructors and Destructors
27 //------------------------------------------------------------------
28 StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
30 StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr,
31 uint32_t byte_size, bool hardware);
33 virtual ~StoppointLocation();
35 //------------------------------------------------------------------
37 //------------------------------------------------------------------
39 //------------------------------------------------------------------
41 //------------------------------------------------------------------
42 virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
44 virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
46 uint32_t GetByteSize() const { return m_byte_size; }
48 uint32_t GetHitCount() const { return m_hit_count; }
50 uint32_t GetHardwareIndex() const { return m_hardware_index; }
52 bool HardwareRequired() const { return m_hardware; }
54 virtual bool IsHardware() const {
55 return m_hardware_index != LLDB_INVALID_INDEX32;
58 virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
60 virtual void Dump(Stream *stream) const {}
62 void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
64 lldb::break_id_t GetID() const { return m_loc_id; }
67 //------------------------------------------------------------------
68 // Classes that inherit from StoppointLocation can see and modify these
69 //------------------------------------------------------------------
70 lldb::break_id_t m_loc_id; // Stoppoint location ID
72 m_addr; // The load address of this stop point. The base Stoppoint doesn't
73 // store a full Address since that's not needed for the breakpoint sites.
74 bool m_hardware; // True if this point has been is required to use hardware
75 // (which may fail due to lack of resources)
76 uint32_t m_hardware_index; // The hardware resource index for this
77 // breakpoint/watchpoint
78 uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length
79 // of the trap opcode for
80 // software breakpoints, or the optional length in bytes for hardware
81 // breakpoints, or the length of the watchpoint.
83 m_hit_count; // Number of times this breakpoint/watchpoint has been hit
85 // If you override this, be sure to call the base class to increment the
87 void IncrementHitCount() { ++m_hit_count; }
89 void DecrementHitCount();
92 //------------------------------------------------------------------
93 // For StoppointLocation only
94 //------------------------------------------------------------------
95 DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
96 StoppointLocation(); // Disallow default constructor
99 } // namespace lldb_private
101 #endif // liblldb_StoppointLocation_h_