StoppointLocation.h revision 116a5cd7b8a0ec7929f10281cd708edb2bf20ffa
1//===-- StoppointLocation.h -------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_StoppointLocation_h_ 11#define liblldb_StoppointLocation_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/lldb-private.h" 18#include "lldb/Core/UserID.h" 19// #include "lldb/Breakpoint/BreakpointOptions.h" 20 21namespace lldb_private { 22 23class StoppointLocation 24{ 25public: 26 //------------------------------------------------------------------ 27 // Constructors and Destructors 28 //------------------------------------------------------------------ 29 StoppointLocation (lldb::break_id_t bid, 30 lldb::addr_t m_addr, 31 bool hardware); 32 33 StoppointLocation (lldb::break_id_t bid, 34 lldb::addr_t m_addr, 35 uint32_t byte_size, 36 bool hardware); 37 38 virtual 39 ~StoppointLocation (); 40 41 //------------------------------------------------------------------ 42 // Operators 43 //------------------------------------------------------------------ 44 45 //------------------------------------------------------------------ 46 // Methods 47 //------------------------------------------------------------------ 48 virtual lldb::addr_t 49 GetLoadAddress() const 50 { 51 return m_addr; 52 } 53 54 virtual void 55 SetLoadAddress (lldb::addr_t addr) 56 { 57 m_addr = addr; 58 } 59 60 uint32_t 61 GetByteSize () const 62 { 63 return m_byte_size; 64 } 65 66 uint32_t 67 GetHitCount () const 68 { 69 return m_hit_count; 70 } 71 72 void 73 IncrementHitCount () 74 { 75 ++m_hit_count; 76 } 77 78 uint32_t 79 GetHardwareIndex () const 80 { 81 return m_hw_index; 82 } 83 84 85 bool 86 HardwarePreferred () const 87 { 88 return m_hw_preferred; 89 } 90 91 virtual bool 92 IsHardware () const 93 { 94 return m_hw_index != LLDB_INVALID_INDEX32; 95 } 96 97 98 virtual bool 99 ShouldStop (StoppointCallbackContext *context) 100 { 101 return true; 102 } 103 104 virtual void 105 Dump (Stream *stream) const 106 { 107 } 108 109 void 110 SetHardwareIndex (uint32_t index) 111 { 112 m_hw_index = index; 113 } 114 115 116 lldb::break_id_t 117 GetID () const 118 { 119 return m_loc_id; 120 } 121 122protected: 123 //------------------------------------------------------------------ 124 // Classes that inherit from StoppointLocation can see and modify these 125 //------------------------------------------------------------------ 126 lldb::break_id_t m_loc_id; // Stoppoint location ID 127 lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't 128 // store a full Address since that's not needed for the breakpoint sites. 129 bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources) 130 uint32_t m_hw_index; // The hardware resource index for this breakpoint/watchpoint 131 uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for 132 // software breakpoints, or the optional length in bytes for 133 // hardware breakpoints, or the length of the watchpoint. 134 uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit 135 136private: 137 //------------------------------------------------------------------ 138 // For StoppointLocation only 139 //------------------------------------------------------------------ 140 DISALLOW_COPY_AND_ASSIGN(StoppointLocation); 141 StoppointLocation(); // Disallow default constructor 142}; 143 144} // namespace lldb_private 145 146#endif // liblldb_StoppointLocation_h_ 147