LLDB mainline
BreakpointLocationCollection.h
Go to the documentation of this file.
1//===-- BreakpointLocationCollection.h --------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_BREAKPOINT_BREAKPOINTLOCATIONCOLLECTION_H
10#define LLDB_BREAKPOINT_BREAKPOINTLOCATIONCOLLECTION_H
11
12#include <mutex>
13#include <vector>
14
16#include "lldb/lldb-private.h"
17
18namespace lldb_private {
19
21public:
23
25
27
28 /// Add the breakpoint \a bp_loc_sp to the list.
29 ///
30 /// \param[in] bp_loc_sp
31 /// Shared pointer to the breakpoint location that will get added
32 /// to the list.
33 void Add(const lldb::BreakpointLocationSP &bp_loc_sp);
34
35 /// Removes the breakpoint location given by \b breakID from this
36 /// list.
37 ///
38 /// \param[in] break_id
39 /// The breakpoint index to remove.
40 ///
41 /// \param[in] break_loc_id
42 /// The breakpoint location index in break_id to remove.
43 ///
44 /// \result
45 /// \b true if the breakpoint was in the list.
46 bool Remove(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
47
48 /// Returns a shared pointer to the breakpoint location with id \a
49 /// breakID.
50 ///
51 /// \param[in] break_id
52 /// The breakpoint ID to seek for.
53 ///
54 /// \param[in] break_loc_id
55 /// The breakpoint location ID in \a break_id to seek for.
56 ///
57 /// \result
58 /// A shared pointer to the breakpoint. May contain a NULL
59 /// pointer if the breakpoint doesn't exist.
61 lldb::break_id_t break_loc_id);
62
63 /// Returns a shared pointer to the breakpoint location with id \a
64 /// breakID, const version.
65 ///
66 /// \param[in] break_id
67 /// The breakpoint location ID to seek for.
68 ///
69 /// \param[in] break_loc_id
70 /// The breakpoint location ID in \a break_id to seek for.
71 ///
72 /// \result
73 /// A shared pointer to the breakpoint. May contain a NULL
74 /// pointer if the breakpoint doesn't exist.
76 FindByIDPair(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
77
78 /// Returns a shared pointer to the breakpoint location with index
79 /// \a i.
80 ///
81 /// \param[in] i
82 /// The breakpoint location index to seek for.
83 ///
84 /// \result
85 /// A shared pointer to the breakpoint. May contain a NULL
86 /// pointer if the breakpoint doesn't exist.
88
89 /// Returns a shared pointer to the breakpoint location with index
90 /// \a i, const version.
91 ///
92 /// \param[in] i
93 /// The breakpoint location index to seek for.
94 ///
95 /// \result
96 /// A shared pointer to the breakpoint. May contain a NULL
97 /// pointer if the breakpoint doesn't exist.
98 const lldb::BreakpointLocationSP GetByIndex(size_t i) const;
99
100 /// Returns the number of elements in this breakpoint location list.
101 ///
102 /// \result
103 /// The number of elements.
104 size_t GetSize() const { return m_break_loc_collection.size(); }
105
106 /// Enquires of all the breakpoint locations in this list whether
107 /// we should stop at a hit at \a breakID.
108 ///
109 /// \param[in] context
110 /// This contains the information about this stop.
111 ///
112 /// \return
113 /// \b true if we should stop, \b false otherwise.
115
116 /// Print a description of the breakpoint locations in this list
117 /// to the stream \a s.
118 ///
119 /// \param[in] s
120 /// The stream to which to print the description.
121 ///
122 /// \param[in] level
123 /// The description level that indicates the detail level to
124 /// provide.
125 ///
126 /// \see lldb::DescriptionLevel
128
129 /// Check whether this collection of breakpoint locations have any
130 /// thread specifiers, and if yes, is \a thread_id contained in any
131 /// of these specifiers.
132 ///
133 /// \param[in] thread
134 /// The thread against which to test.
135 ///
136 /// return
137 /// \b true if the collection contains at least one location that
138 /// would be valid for this thread, false otherwise.
139 bool ValidForThisThread(Thread &thread);
140
141 /// Tell whether ALL the breakpoints in the location collection are internal.
142 ///
143 /// \result
144 /// \b true if all breakpoint locations are owned by internal breakpoints,
145 /// \b false otherwise.
146 bool IsInternal() const;
147
148protected:
149 // Classes that inherit from BreakpointLocationCollection can see and modify
150 // these
151
152private:
153 // For BreakpointLocationCollection only
154
155 typedef std::vector<lldb::BreakpointLocationSP> collection;
156
157 collection::iterator GetIDPairIterator(lldb::break_id_t break_id,
158 lldb::break_id_t break_loc_id);
159
160 collection::const_iterator
162 lldb::break_id_t break_loc_id) const;
163
165 mutable std::mutex m_collection_mutex;
166
167public:
173 }
174};
175
176} // namespace lldb_private
177
178#endif // LLDB_BREAKPOINT_BREAKPOINTLOCATIONCOLLECTION_H
lldb::BreakpointLocationSP FindByIDPair(lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
Returns a shared pointer to the breakpoint location with id breakID.
void GetDescription(Stream *s, lldb::DescriptionLevel level)
Print a description of the breakpoint locations in this list to the stream s.
bool IsInternal() const
Tell whether ALL the breakpoints in the location collection are internal.
bool ValidForThisThread(Thread &thread)
Check whether this collection of breakpoint locations have any thread specifiers, and if yes,...
collection::const_iterator GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const
BreakpointLocationCollection & operator=(const BreakpointLocationCollection &rhs)
collection::iterator GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
bool ShouldStop(StoppointCallbackContext *context)
Enquires of all the breakpoint locations in this list whether we should stop at a hit at breakID.
std::vector< lldb::BreakpointLocationSP > collection
BreakpointLocationCollectionIterable BreakpointLocations()
AdaptedIterable< collection, lldb::BreakpointLocationSP, vector_adapter > BreakpointLocationCollectionIterable
lldb::BreakpointLocationSP GetByIndex(size_t i)
Returns a shared pointer to the breakpoint location with index i.
void Add(const lldb::BreakpointLocationSP &bp_loc_sp)
Add the breakpoint bp_loc_sp to the list.
bool Remove(lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
Removes the breakpoint location given by breakID from this list.
size_t GetSize() const
Returns the number of elements in this breakpoint location list.
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.
E vector_adapter(I &iter)
Definition: Iterable.h:21
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
Definition: lldb-forward.h:322
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
int32_t break_id_t
Definition: lldb-types.h:86