1 //===-- BreakpointLocationCollection.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_BreakpointLocationCollection_h_
11 #define liblldb_BreakpointLocationCollection_h_
18 // Other libraries and framework includes
20 #include "lldb/lldb-private.h"
21 #include "lldb/Utility/Iterable.h"
23 namespace lldb_private {
25 class BreakpointLocationCollection
28 BreakpointLocationCollection();
30 ~BreakpointLocationCollection();
32 //------------------------------------------------------------------
33 /// Add the breakpoint \a bp_loc_sp to the list.
36 /// Shared pointer to the breakpoint location that will get added
40 /// Returns breakpoint location id.
41 //------------------------------------------------------------------
43 Add (const lldb::BreakpointLocationSP& bp_loc_sp);
45 //------------------------------------------------------------------
46 /// Removes the breakpoint location given by \b breakID from this
49 /// @param[in] break_id
50 /// The breakpoint index to remove.
52 /// @param[in] break_loc_id
53 /// The breakpoint location index in break_id to remove.
56 /// \b true if the breakpoint was in the list.
57 //------------------------------------------------------------------
59 Remove (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
61 //------------------------------------------------------------------
62 /// Returns a shared pointer to the breakpoint location with id \a
65 /// @param[in] break_id
66 /// The breakpoint ID to seek for.
68 /// @param[in] break_loc_id
69 /// The breakpoint location ID in \a break_id to seek for.
72 /// A shared pointer to the breakpoint. May contain a NULL
73 /// pointer if the breakpoint doesn't exist.
74 //------------------------------------------------------------------
75 lldb::BreakpointLocationSP
76 FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
78 //------------------------------------------------------------------
79 /// Returns a shared pointer to the breakpoint location with id \a
80 /// breakID, const version.
82 /// @param[in] breakID
83 /// The breakpoint location ID to seek for.
85 /// @param[in] break_loc_id
86 /// The breakpoint location ID in \a break_id to seek for.
89 /// A shared pointer to the breakpoint. May contain a NULL
90 /// pointer if the breakpoint doesn't exist.
91 //------------------------------------------------------------------
92 const lldb::BreakpointLocationSP
93 FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
95 //------------------------------------------------------------------
96 /// Returns a shared pointer to the breakpoint location with index
100 /// The breakpoint location index to seek for.
103 /// A shared pointer to the breakpoint. May contain a NULL
104 /// pointer if the breakpoint doesn't exist.
105 //------------------------------------------------------------------
106 lldb::BreakpointLocationSP
107 GetByIndex (size_t i);
109 //------------------------------------------------------------------
110 /// Returns a shared pointer to the breakpoint location with index
111 /// \a i, const version.
114 /// The breakpoint location index to seek for.
117 /// A shared pointer to the breakpoint. May contain a NULL
118 /// pointer if the breakpoint doesn't exist.
119 //------------------------------------------------------------------
120 const lldb::BreakpointLocationSP
121 GetByIndex (size_t i) const;
123 //------------------------------------------------------------------
124 /// Returns the number of elements in this breakpoint location list.
127 /// The number of elements.
128 //------------------------------------------------------------------
130 GetSize() const { return m_break_loc_collection.size(); }
132 //------------------------------------------------------------------
133 /// Enquires of all the breakpoint locations in this list whether
134 /// we should stop at a hit at \a breakID.
136 /// @param[in] context
137 /// This contains the information about this stop.
139 /// @param[in] breakID
140 /// This break ID that we hit.
143 /// \b true if we should stop, \b false otherwise.
144 //------------------------------------------------------------------
146 ShouldStop (StoppointCallbackContext *context);
148 //------------------------------------------------------------------
149 /// Print a description of the breakpoint locations in this list
150 /// to the stream \a s.
153 /// The stream to which to print the description.
156 /// The description level that indicates the detail level to
159 /// @see lldb::DescriptionLevel
160 //------------------------------------------------------------------
161 void GetDescription (Stream *s, lldb::DescriptionLevel level);
163 //------------------------------------------------------------------
164 /// Check whether this collection of breakpoint locations have any
165 /// thread specifiers, and if yes, is \a thread_id contained in any
166 /// of these specifiers.
168 /// @param[in] thread
169 /// The thread against which to test.
172 /// \b true if the collection contains at least one location that
173 /// would be valid for this thread, false otherwise.
174 //------------------------------------------------------------------
175 bool ValidForThisThread (Thread *thread);
177 //------------------------------------------------------------------
178 /// Tell whether ALL the breakpoints in the location collection are internal.
181 /// \b true if all breakpoint locations are owned by internal breakpoints,
182 /// \b false otherwise.
183 //------------------------------------------------------------------
184 bool IsInternal() const;
188 //------------------------------------------------------------------
189 // Classes that inherit from BreakpointLocationCollection can see
191 //------------------------------------------------------------------
194 //------------------------------------------------------------------
195 // For BreakpointLocationCollection only
196 //------------------------------------------------------------------
198 typedef std::vector<lldb::BreakpointLocationSP> collection;
201 GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
203 collection::const_iterator
204 GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
206 collection m_break_loc_collection;
207 mutable std::mutex m_collection_mutex;
210 typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationCollectionIterable;
211 BreakpointLocationCollectionIterable
212 BreakpointLocations()
214 return BreakpointLocationCollectionIterable(m_break_loc_collection);
219 } // namespace lldb_private
221 #endif // liblldb_BreakpointLocationCollection_h_