]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
MFV r306669:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Breakpoint / BreakpointLocationCollection.h
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 #include "lldb/Utility/Iterable.h"
20
21 namespace lldb_private {
22
23 class BreakpointLocationCollection
24 {
25 public:
26     BreakpointLocationCollection();
27
28     ~BreakpointLocationCollection();
29
30     //------------------------------------------------------------------
31     /// Add the breakpoint \a bp_loc_sp to the list.
32     ///
33     /// @param[in] bp_sp
34     ///     Shared pointer to the breakpoint location that will get added
35     ///     to the list.
36     ///
37     /// @result
38     ///     Returns breakpoint location id.
39     //------------------------------------------------------------------
40     void
41     Add (const lldb::BreakpointLocationSP& bp_loc_sp);
42
43     //------------------------------------------------------------------
44     /// Removes the breakpoint location given by \b breakID from this
45     /// list.
46     ///
47     /// @param[in] break_id
48     ///     The breakpoint index to remove.
49     ///
50     /// @param[in] break_loc_id
51     ///     The breakpoint location index in break_id to remove.
52     ///
53     /// @result
54     ///     \b true if the breakpoint was in the list.
55     //------------------------------------------------------------------
56     bool
57     Remove (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
58
59     //------------------------------------------------------------------
60     /// Returns a shared pointer to the breakpoint location with id \a
61     /// breakID.
62     ///
63     /// @param[in] break_id
64     ///     The breakpoint  ID to seek for.
65     ///
66     /// @param[in] break_loc_id
67     ///     The breakpoint location ID in \a break_id to seek for.
68     ///
69     /// @result
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);
75
76     //------------------------------------------------------------------
77     /// Returns a shared pointer to the breakpoint location with id \a
78     /// breakID, const version.
79     ///
80     /// @param[in] breakID
81     ///     The breakpoint location ID to seek for.
82     ///
83     /// @param[in] break_loc_id
84     ///     The breakpoint location ID in \a break_id to seek for.
85     ///
86     /// @result
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;
92
93     //------------------------------------------------------------------
94     /// Returns a shared pointer to the breakpoint location with index
95     /// \a i.
96     ///
97     /// @param[in] i
98     ///     The breakpoint location index to seek for.
99     ///
100     /// @result
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);
106
107     //------------------------------------------------------------------
108     /// Returns a shared pointer to the breakpoint location with index
109     /// \a i, const version.
110     ///
111     /// @param[in] i
112     ///     The breakpoint location index to seek for.
113     ///
114     /// @result
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;
120
121     //------------------------------------------------------------------
122     /// Returns the number of elements in this breakpoint location list.
123     ///
124     /// @result
125     ///     The number of elements.
126     //------------------------------------------------------------------
127     size_t
128     GetSize() const { return m_break_loc_collection.size(); }
129
130     //------------------------------------------------------------------
131     /// Enquires of all the breakpoint locations in this list whether
132     /// we should stop at a hit at \a breakID.
133     ///
134     /// @param[in] context
135     ///    This contains the information about this stop.
136     ///
137     /// @param[in] breakID
138     ///    This break ID that we hit.
139     ///
140     /// @return
141     ///    \b true if we should stop, \b false otherwise.
142     //------------------------------------------------------------------
143     bool
144     ShouldStop (StoppointCallbackContext *context);
145
146     //------------------------------------------------------------------
147     /// Print a description of the breakpoint locations in this list
148     /// to the stream \a s.
149     ///
150     /// @param[in] s
151     ///     The stream to which to print the description.
152     ///
153     /// @param[in] level
154     ///     The description level that indicates the detail level to
155     ///     provide.
156     ///
157     /// @see lldb::DescriptionLevel
158     //------------------------------------------------------------------
159     void GetDescription (Stream *s, lldb::DescriptionLevel level);
160     
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.
165     ///
166     /// @param[in] thread
167     ///     The thread against which to test.
168     ///
169     /// return
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);
174
175     //------------------------------------------------------------------
176     /// Tell whether ALL the breakpoints in the location collection are internal.
177     ///
178     /// @result
179     ///     \b true if all breakpoint locations are owned by internal breakpoints,
180     ///     \b false otherwise.
181     //------------------------------------------------------------------
182     bool IsInternal() const;
183
184
185 protected:
186     //------------------------------------------------------------------
187     // Classes that inherit from BreakpointLocationCollection can see
188     // and modify these
189     //------------------------------------------------------------------
190
191 private:
192     //------------------------------------------------------------------
193     // For BreakpointLocationCollection only
194     //------------------------------------------------------------------
195
196     typedef std::vector<lldb::BreakpointLocationSP> collection;
197
198     collection::iterator
199     GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
200
201     collection::const_iterator
202     GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
203
204     collection m_break_loc_collection;
205
206 public:
207     typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationCollectionIterable;
208     BreakpointLocationCollectionIterable
209     BreakpointLocations()
210     {
211         return BreakpointLocationCollectionIterable(m_break_loc_collection);
212     }
213
214 };
215
216 } // namespace lldb_private
217
218 #endif  // liblldb_BreakpointLocationCollection_h_