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_
16 // Other libraries and framework includes
18 #include "lldb/lldb-private.h"
19 #include "lldb/Utility/Iterable.h"
21 namespace lldb_private {
23 class BreakpointLocationCollection
26 BreakpointLocationCollection();
28 ~BreakpointLocationCollection();
30 //------------------------------------------------------------------
31 /// Add the breakpoint \a bp_loc_sp to the list.
34 /// Shared pointer to the breakpoint location that will get added
38 /// Returns breakpoint location id.
39 //------------------------------------------------------------------
41 Add (const lldb::BreakpointLocationSP& bp_loc_sp);
43 //------------------------------------------------------------------
44 /// Removes the breakpoint location given by \b breakID from this
47 /// @param[in] break_id
48 /// The breakpoint index to remove.
50 /// @param[in] break_loc_id
51 /// The breakpoint location index in break_id to remove.
54 /// \b true if the breakpoint was in the list.
55 //------------------------------------------------------------------
57 Remove (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
59 //------------------------------------------------------------------
60 /// Returns a shared pointer to the breakpoint location with id \a
63 /// @param[in] break_id
64 /// The breakpoint ID to seek for.
66 /// @param[in] break_loc_id
67 /// The breakpoint location ID in \a break_id to seek for.
70 /// A shared pointer to the breakpoint. May contain a NULL
71 /// pointer if the breakpoint doesn't exist.
72 //------------------------------------------------------------------
73 lldb::BreakpointLocationSP
74 FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
76 //------------------------------------------------------------------
77 /// Returns a shared pointer to the breakpoint location with id \a
78 /// breakID, const version.
80 /// @param[in] breakID
81 /// The breakpoint location ID to seek for.
83 /// @param[in] break_loc_id
84 /// The breakpoint location ID in \a break_id to seek for.
87 /// A shared pointer to the breakpoint. May contain a NULL
88 /// pointer if the breakpoint doesn't exist.
89 //------------------------------------------------------------------
90 const lldb::BreakpointLocationSP
91 FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
93 //------------------------------------------------------------------
94 /// Returns a shared pointer to the breakpoint location with index
98 /// The breakpoint location index to seek for.
101 /// A shared pointer to the breakpoint. May contain a NULL
102 /// pointer if the breakpoint doesn't exist.
103 //------------------------------------------------------------------
104 lldb::BreakpointLocationSP
105 GetByIndex (size_t i);
107 //------------------------------------------------------------------
108 /// Returns a shared pointer to the breakpoint location with index
109 /// \a i, const version.
112 /// The breakpoint location index to seek for.
115 /// A shared pointer to the breakpoint. May contain a NULL
116 /// pointer if the breakpoint doesn't exist.
117 //------------------------------------------------------------------
118 const lldb::BreakpointLocationSP
119 GetByIndex (size_t i) const;
121 //------------------------------------------------------------------
122 /// Returns the number of elements in this breakpoint location list.
125 /// The number of elements.
126 //------------------------------------------------------------------
128 GetSize() const { return m_break_loc_collection.size(); }
130 //------------------------------------------------------------------
131 /// Enquires of all the breakpoint locations in this list whether
132 /// we should stop at a hit at \a breakID.
134 /// @param[in] context
135 /// This contains the information about this stop.
137 /// @param[in] breakID
138 /// This break ID that we hit.
141 /// \b true if we should stop, \b false otherwise.
142 //------------------------------------------------------------------
144 ShouldStop (StoppointCallbackContext *context);
146 //------------------------------------------------------------------
147 /// Print a description of the breakpoint locations in this list
148 /// to the stream \a s.
151 /// The stream to which to print the description.
154 /// The description level that indicates the detail level to
157 /// @see lldb::DescriptionLevel
158 //------------------------------------------------------------------
159 void GetDescription (Stream *s, lldb::DescriptionLevel level);
161 //------------------------------------------------------------------
162 /// Check whether this collection of breakpoint locations have any
163 /// thread specifiers, and if yes, is \a thread_id contained in any
164 /// of these specifiers.
166 /// @param[in] thread
167 /// The thread against which to test.
170 /// \b true if the collection contains at least one location that
171 /// would be valid for this thread, false otherwise.
172 //------------------------------------------------------------------
173 bool ValidForThisThread (Thread *thread);
175 //------------------------------------------------------------------
176 /// Tell whether ALL the breakpoints in the location collection are internal.
179 /// \b true if all breakpoint locations are owned by internal breakpoints,
180 /// \b false otherwise.
181 //------------------------------------------------------------------
182 bool IsInternal() const;
186 //------------------------------------------------------------------
187 // Classes that inherit from BreakpointLocationCollection can see
189 //------------------------------------------------------------------
192 //------------------------------------------------------------------
193 // For BreakpointLocationCollection only
194 //------------------------------------------------------------------
196 typedef std::vector<lldb::BreakpointLocationSP> collection;
199 GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
201 collection::const_iterator
202 GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
204 collection m_break_loc_collection;
207 typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationCollectionIterable;
208 BreakpointLocationCollectionIterable
209 BreakpointLocations()
211 return BreakpointLocationCollectionIterable(m_break_loc_collection);
216 } // namespace lldb_private
218 #endif // liblldb_BreakpointLocationCollection_h_