1 //===-- BreakpointLocationCollection.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_BreakpointLocationCollection_h_ 11 #define liblldb_BreakpointLocationCollection_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <vector> 16 // Other libraries and framework includes 17 // Project includes 18 #include "lldb/lldb-private.h" 19 20 namespace lldb_private { 21 22 class BreakpointLocationCollection 23 { 24 public: 25 BreakpointLocationCollection(); 26 27 ~BreakpointLocationCollection(); 28 29 //------------------------------------------------------------------ 30 /// Add the breakpoint \a bp_loc_sp to the list. 31 /// 32 /// @param[in] bp_sp 33 /// Shared pointer to the breakpoint location that will get added 34 /// to the list. 35 /// 36 /// @result 37 /// Returns breakpoint location id. 38 //------------------------------------------------------------------ 39 void 40 Add (const lldb::BreakpointLocationSP& bp_loc_sp); 41 42 //------------------------------------------------------------------ 43 /// Removes the breakpoint location given by \b breakID from this 44 /// list. 45 /// 46 /// @param[in] break_id 47 /// The breakpoint index to remove. 48 /// 49 /// @param[in] break_loc_id 50 /// The breakpoint location index in break_id to remove. 51 /// 52 /// @result 53 /// \b true if the breakpoint was in the list. 54 //------------------------------------------------------------------ 55 bool 56 Remove (lldb::break_id_t break_id, lldb::break_id_t break_loc_id); 57 58 //------------------------------------------------------------------ 59 /// Returns a shared pointer to the breakpoint location with id \a 60 /// breakID. 61 /// 62 /// @param[in] break_id 63 /// The breakpoint ID to seek for. 64 /// 65 /// @param[in] break_loc_id 66 /// The breakpoint location ID in \a break_id to seek for. 67 /// 68 /// @result 69 /// A shared pointer to the breakpoint. May contain a NULL 70 /// pointer if the breakpoint doesn't exist. 71 //------------------------------------------------------------------ 72 lldb::BreakpointLocationSP 73 FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id); 74 75 //------------------------------------------------------------------ 76 /// Returns a shared pointer to the breakpoint location with id \a 77 /// breakID, const version. 78 /// 79 /// @param[in] breakID 80 /// The breakpoint location ID to seek for. 81 /// 82 /// @param[in] break_loc_id 83 /// The breakpoint location ID in \a break_id to seek for. 84 /// 85 /// @result 86 /// A shared pointer to the breakpoint. May contain a NULL 87 /// pointer if the breakpoint doesn't exist. 88 //------------------------------------------------------------------ 89 const lldb::BreakpointLocationSP 90 FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const; 91 92 //------------------------------------------------------------------ 93 /// Returns a shared pointer to the breakpoint location with index 94 /// \a i. 95 /// 96 /// @param[in] i 97 /// The breakpoint location index to seek for. 98 /// 99 /// @result 100 /// A shared pointer to the breakpoint. May contain a NULL 101 /// pointer if the breakpoint doesn't exist. 102 //------------------------------------------------------------------ 103 lldb::BreakpointLocationSP 104 GetByIndex (size_t i); 105 106 //------------------------------------------------------------------ 107 /// Returns a shared pointer to the breakpoint location with index 108 /// \a i, const version. 109 /// 110 /// @param[in] i 111 /// The breakpoint location index to seek for. 112 /// 113 /// @result 114 /// A shared pointer to the breakpoint. May contain a NULL 115 /// pointer if the breakpoint doesn't exist. 116 //------------------------------------------------------------------ 117 const lldb::BreakpointLocationSP 118 GetByIndex (size_t i) const; 119 120 //------------------------------------------------------------------ 121 /// Returns the number of elements in this breakpoint location list. 122 /// 123 /// @result 124 /// The number of elements. 125 //------------------------------------------------------------------ 126 size_t GetSize()127 GetSize() const { return m_break_loc_collection.size(); } 128 129 //------------------------------------------------------------------ 130 /// Enquires of all the breakpoint locations in this list whether 131 /// we should stop at a hit at \a breakID. 132 /// 133 /// @param[in] context 134 /// This contains the information about this stop. 135 /// 136 /// @param[in] breakID 137 /// This break ID that we hit. 138 /// 139 /// @return 140 /// \b true if we should stop, \b false otherwise. 141 //------------------------------------------------------------------ 142 bool 143 ShouldStop (StoppointCallbackContext *context); 144 145 //------------------------------------------------------------------ 146 /// Print a description of the breakpoint locations in this list 147 /// to the stream \a s. 148 /// 149 /// @param[in] s 150 /// The stream to which to print the description. 151 /// 152 /// @param[in] level 153 /// The description level that indicates the detail level to 154 /// provide. 155 /// 156 /// @see lldb::DescriptionLevel 157 //------------------------------------------------------------------ 158 void GetDescription (Stream *s, lldb::DescriptionLevel level); 159 160 //------------------------------------------------------------------ 161 /// Check whether this collection of breakpoint locations have any 162 /// thread specifiers, and if yes, is \a thread_id contained in any 163 /// of these specifiers. 164 /// 165 /// @param[in] thread 166 /// The thread against which to test. 167 /// 168 /// return 169 /// \b true if the collection contains at least one location that 170 /// would be valid for this thread, false otherwise. 171 //------------------------------------------------------------------ 172 bool ValidForThisThread (Thread *thread); 173 174 //------------------------------------------------------------------ 175 /// Tell whether ALL the breakpoints in the location collection are internal. 176 /// 177 /// @result 178 /// \b true if all breakpoint locations are owned by internal breakpoints, 179 /// \b false otherwise. 180 //------------------------------------------------------------------ 181 bool IsInternal() const; 182 183 184 protected: 185 //------------------------------------------------------------------ 186 // Classes that inherit from BreakpointLocationCollection can see 187 // and modify these 188 //------------------------------------------------------------------ 189 190 private: 191 //------------------------------------------------------------------ 192 // For BreakpointLocationCollection only 193 //------------------------------------------------------------------ 194 195 typedef std::vector<lldb::BreakpointLocationSP> collection; 196 197 collection::iterator 198 GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id); 199 200 collection::const_iterator 201 GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const; 202 203 collection m_break_loc_collection; 204 205 }; 206 207 } // namespace lldb_private 208 209 #endif // liblldb_BreakpointLocationCollection_h_ 210