summaryrefslogtreecommitdiffstats
path: root/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Breakpoint/BreakpointLocationCollection.cpp
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointLocationCollection.cpp')
-rw-r--r--lldb/source/Breakpoint/BreakpointLocationCollection.cpp272
1 files changed, 122 insertions, 150 deletions
diff --git a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
index 52698b2f15b..6536002bda6 100644
--- a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
@@ -7,15 +7,14 @@
//
//===----------------------------------------------------------------------===//
-
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
-#include "lldb/Core/ModuleList.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Core/ModuleList.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadSpec.h"
@@ -25,189 +24,162 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// BreakpointLocationCollection constructor
//----------------------------------------------------------------------
-BreakpointLocationCollection::BreakpointLocationCollection() :
- m_break_loc_collection(),
- m_collection_mutex()
-{
-}
+BreakpointLocationCollection::BreakpointLocationCollection()
+ : m_break_loc_collection(), m_collection_mutex() {}
//----------------------------------------------------------------------
// Destructor
//----------------------------------------------------------------------
-BreakpointLocationCollection::~BreakpointLocationCollection()
-{
+BreakpointLocationCollection::~BreakpointLocationCollection() {}
+
+void BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc) {
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
+ BreakpointLocationSP old_bp_loc =
+ FindByIDPair(bp_loc->GetBreakpoint().GetID(), bp_loc->GetID());
+ if (!old_bp_loc.get())
+ m_break_loc_collection.push_back(bp_loc);
}
-void
-BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc)
-{
- std::lock_guard<std::mutex> guard(m_collection_mutex);
- BreakpointLocationSP old_bp_loc = FindByIDPair (bp_loc->GetBreakpoint().GetID(), bp_loc->GetID());
- if (!old_bp_loc.get())
- m_break_loc_collection.push_back(bp_loc);
+bool BreakpointLocationCollection::Remove(lldb::break_id_t bp_id,
+ lldb::break_id_t bp_loc_id) {
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
+ collection::iterator pos = GetIDPairIterator(bp_id, bp_loc_id); // Predicate
+ if (pos != m_break_loc_collection.end()) {
+ m_break_loc_collection.erase(pos);
+ return true;
+ }
+ return false;
}
-bool
-BreakpointLocationCollection::Remove (lldb::break_id_t bp_id, lldb::break_id_t bp_loc_id)
-{
- std::lock_guard<std::mutex> guard(m_collection_mutex);
- collection::iterator pos = GetIDPairIterator(bp_id, bp_loc_id); // Predicate
- if (pos != m_break_loc_collection.end())
- {
- m_break_loc_collection.erase(pos);
- return true;
- }
- return false;
-
-}
-
-class BreakpointIDPairMatches
-{
+class BreakpointIDPairMatches {
public:
- BreakpointIDPairMatches (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) :
- m_break_id(break_id),
- m_break_loc_id (break_loc_id)
- {
- }
+ BreakpointIDPairMatches(lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id)
+ : m_break_id(break_id), m_break_loc_id(break_loc_id) {}
- bool operator() (const BreakpointLocationSP &bp_loc) const
- {
- return m_break_id == bp_loc->GetBreakpoint().GetID()
- && m_break_loc_id == bp_loc->GetID();
- }
+ bool operator()(const BreakpointLocationSP &bp_loc) const {
+ return m_break_id == bp_loc->GetBreakpoint().GetID() &&
+ m_break_loc_id == bp_loc->GetID();
+ }
private:
- const lldb::break_id_t m_break_id;
- const lldb::break_id_t m_break_loc_id;
+ const lldb::break_id_t m_break_id;
+ const lldb::break_id_t m_break_loc_id;
};
BreakpointLocationCollection::collection::iterator
-BreakpointLocationCollection::GetIDPairIterator (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
-{
- return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range
- BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
+BreakpointLocationCollection::GetIDPairIterator(lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id) {
+ return std::find_if(
+ m_break_loc_collection.begin(),
+ m_break_loc_collection.end(), // Search full range
+ BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
}
BreakpointLocationCollection::collection::const_iterator
-BreakpointLocationCollection::GetIDPairConstIterator (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const
-{
- return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range
- BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
+BreakpointLocationCollection::GetIDPairConstIterator(
+ lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const {
+ return std::find_if(
+ m_break_loc_collection.begin(),
+ m_break_loc_collection.end(), // Search full range
+ BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
}
BreakpointLocationSP
-BreakpointLocationCollection::FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
-{
- BreakpointLocationSP stop_sp;
- collection::iterator pos = GetIDPairIterator(break_id, break_loc_id);
- if (pos != m_break_loc_collection.end())
- stop_sp = *pos;
-
- return stop_sp;
+BreakpointLocationCollection::FindByIDPair(lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id) {
+ BreakpointLocationSP stop_sp;
+ collection::iterator pos = GetIDPairIterator(break_id, break_loc_id);
+ if (pos != m_break_loc_collection.end())
+ stop_sp = *pos;
+
+ return stop_sp;
}
-const BreakpointLocationSP
-BreakpointLocationCollection::FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const
-{
- BreakpointLocationSP stop_sp;
- collection::const_iterator pos = GetIDPairConstIterator(break_id, break_loc_id);
- if (pos != m_break_loc_collection.end())
- stop_sp = *pos;
-
- return stop_sp;
+const BreakpointLocationSP BreakpointLocationCollection::FindByIDPair(
+ lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const {
+ BreakpointLocationSP stop_sp;
+ collection::const_iterator pos =
+ GetIDPairConstIterator(break_id, break_loc_id);
+ if (pos != m_break_loc_collection.end())
+ stop_sp = *pos;
+
+ return stop_sp;
}
-BreakpointLocationSP
-BreakpointLocationCollection::GetByIndex (size_t i)
-{
- std::lock_guard<std::mutex> guard(m_collection_mutex);
- BreakpointLocationSP stop_sp;
- if (i < m_break_loc_collection.size())
- stop_sp = m_break_loc_collection[i];
-
- return stop_sp;
+BreakpointLocationSP BreakpointLocationCollection::GetByIndex(size_t i) {
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
+ BreakpointLocationSP stop_sp;
+ if (i < m_break_loc_collection.size())
+ stop_sp = m_break_loc_collection[i];
+
+ return stop_sp;
}
const BreakpointLocationSP
-BreakpointLocationCollection::GetByIndex (size_t i) const
-{
- std::lock_guard<std::mutex> guard(m_collection_mutex);
- BreakpointLocationSP stop_sp;
- if (i < m_break_loc_collection.size())
- stop_sp = m_break_loc_collection[i];
-
- return stop_sp;
-}
+BreakpointLocationCollection::GetByIndex(size_t i) const {
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
+ BreakpointLocationSP stop_sp;
+ if (i < m_break_loc_collection.size())
+ stop_sp = m_break_loc_collection[i];
-bool
-BreakpointLocationCollection::ShouldStop (StoppointCallbackContext *context)
-{
- bool shouldStop = false;
- size_t i = 0;
- size_t prev_size = GetSize();
- while (i < prev_size)
- {
- // ShouldStop can remove the breakpoint from the list
- if (GetByIndex(i)->ShouldStop(context))
- shouldStop = true;
-
- if (prev_size == GetSize())
- i++;
- prev_size = GetSize();
- }
- return shouldStop;
+ return stop_sp;
}
-bool
-BreakpointLocationCollection::ValidForThisThread (Thread *thread)
-{
- std::lock_guard<std::mutex> guard(m_collection_mutex);
- collection::iterator pos,
- begin = m_break_loc_collection.begin(),
- end = m_break_loc_collection.end();
-
- for (pos = begin; pos != end; ++pos)
- {
- if ((*pos)->ValidForThisThread (thread))
- return true;
- }
- return false;
+bool BreakpointLocationCollection::ShouldStop(
+ StoppointCallbackContext *context) {
+ bool shouldStop = false;
+ size_t i = 0;
+ size_t prev_size = GetSize();
+ while (i < prev_size) {
+ // ShouldStop can remove the breakpoint from the list
+ if (GetByIndex(i)->ShouldStop(context))
+ shouldStop = true;
+
+ if (prev_size == GetSize())
+ i++;
+ prev_size = GetSize();
+ }
+ return shouldStop;
}
-bool
-BreakpointLocationCollection::IsInternal () const
-{
- std::lock_guard<std::mutex> guard(m_collection_mutex);
- collection::const_iterator pos,
- begin = m_break_loc_collection.begin(),
- end = m_break_loc_collection.end();
-
- bool is_internal = true;
-
- for (pos = begin; pos != end; ++pos)
- {
- if (!(*pos)->GetBreakpoint().IsInternal ())
- {
- is_internal = false;
- break;
- }
- }
- return is_internal;
+bool BreakpointLocationCollection::ValidForThisThread(Thread *thread) {
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
+ collection::iterator pos, begin = m_break_loc_collection.begin(),
+ end = m_break_loc_collection.end();
+
+ for (pos = begin; pos != end; ++pos) {
+ if ((*pos)->ValidForThisThread(thread))
+ return true;
+ }
+ return false;
}
-void
-BreakpointLocationCollection::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
- std::lock_guard<std::mutex> guard(m_collection_mutex);
- collection::iterator pos,
- begin = m_break_loc_collection.begin(),
- end = m_break_loc_collection.end();
-
- for (pos = begin; pos != end; ++pos)
- {
- if (pos != begin)
- s->PutChar(' ');
- (*pos)->GetDescription(s, level);
+bool BreakpointLocationCollection::IsInternal() const {
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
+ collection::const_iterator pos, begin = m_break_loc_collection.begin(),
+ end = m_break_loc_collection.end();
+
+ bool is_internal = true;
+
+ for (pos = begin; pos != end; ++pos) {
+ if (!(*pos)->GetBreakpoint().IsInternal()) {
+ is_internal = false;
+ break;
}
+ }
+ return is_internal;
}
+void BreakpointLocationCollection::GetDescription(
+ Stream *s, lldb::DescriptionLevel level) {
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
+ collection::iterator pos, begin = m_break_loc_collection.begin(),
+ end = m_break_loc_collection.end();
+
+ for (pos = begin; pos != end; ++pos) {
+ if (pos != begin)
+ s->PutChar(' ');
+ (*pos)->GetDescription(s, level);
+ }
+}
OpenPOWER on IntegriCloud