diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
| commit | 94994d372d014ce4c8758b9605d63fae651bd8aa (patch) | |
| tree | 51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /source/Breakpoint | |
| parent | 39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff) | |
Notes
Diffstat (limited to 'source/Breakpoint')
24 files changed, 452 insertions, 347 deletions
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp index 1dc029654bfc..131d2a707d44 100644 --- a/source/Breakpoint/Breakpoint.cpp +++ b/source/Breakpoint/Breakpoint.cpp @@ -7,12 +7,8 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes #include "llvm/Support/Casting.h" -// Project includes #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/BreakpointLocationCollection.h" @@ -785,8 +781,8 @@ void Breakpoint::ModuleReplaced(ModuleSP old_module_sp, // we go. if (old_id_vec.size() == new_id_vec.size()) { - llvm::sort(old_id_vec.begin(), old_id_vec.end()); - llvm::sort(new_id_vec.begin(), new_id_vec.end()); + llvm::sort(old_id_vec); + llvm::sort(new_id_vec); size_t num_elements = old_id_vec.size(); for (size_t idx = 0; idx < num_elements; idx++) { BreakpointLocationSP old_loc_sp = @@ -857,6 +853,10 @@ size_t Breakpoint::GetNumResolvedLocations() const { return m_locations.GetNumResolvedLocations(); } +bool Breakpoint::HasResolvedLocations() const { + return GetNumResolvedLocations() > 0; +} + size_t Breakpoint::GetNumLocations() const { return m_locations.GetSize(); } bool Breakpoint::AddName(llvm::StringRef new_name) { diff --git a/source/Breakpoint/BreakpointID.cpp b/source/Breakpoint/BreakpointID.cpp index 3f72f2052b52..eb12e09abcf1 100644 --- a/source/Breakpoint/BreakpointID.cpp +++ b/source/Breakpoint/BreakpointID.cpp @@ -7,12 +7,8 @@ // //===----------------------------------------------------------------------===// -// C Includes #include <stdio.h> -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointID.h" #include "lldb/Utility/Status.h" diff --git a/source/Breakpoint/BreakpointIDList.cpp b/source/Breakpoint/BreakpointIDList.cpp index bc4c2a111fd4..b86f276a5c47 100644 --- a/source/Breakpoint/BreakpointIDList.cpp +++ b/source/Breakpoint/BreakpointIDList.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/lldb-enumerations.h" #include "lldb/Breakpoint/BreakpointIDList.h" diff --git a/source/Breakpoint/BreakpointList.cpp b/source/Breakpoint/BreakpointList.cpp index 4a49b1e105ab..370da10d82b4 100644 --- a/source/Breakpoint/BreakpointList.cpp +++ b/source/Breakpoint/BreakpointList.cpp @@ -9,15 +9,18 @@ #include "lldb/Breakpoint/BreakpointList.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Target/Target.h" using namespace lldb; using namespace lldb_private; +static void NotifyChange(const BreakpointSP &bp, BreakpointEventType event) { + Target &target = bp->GetTarget(); + if (target.EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) + target.BroadcastEvent(Target::eBroadcastBitBreakpointChanged, + new Breakpoint::BreakpointEventData(event, bp)); +} + BreakpointList::BreakpointList(bool is_internal) : m_mutex(), m_breakpoints(), m_next_break_id(0), m_is_internal(is_internal) {} @@ -26,37 +29,34 @@ BreakpointList::~BreakpointList() {} break_id_t BreakpointList::Add(BreakpointSP &bp_sp, bool notify) { std::lock_guard<std::recursive_mutex> guard(m_mutex); + // Internal breakpoint IDs are negative, normal ones are positive bp_sp->SetID(m_is_internal ? --m_next_break_id : ++m_next_break_id); m_breakpoints.push_back(bp_sp); - if (notify) { - if (bp_sp->GetTarget().EventTypeHasListeners( - Target::eBroadcastBitBreakpointChanged)) - bp_sp->GetTarget().BroadcastEvent(Target::eBroadcastBitBreakpointChanged, - new Breakpoint::BreakpointEventData( - eBreakpointEventTypeAdded, bp_sp)); - } + + if (notify) + NotifyChange(bp_sp, eBreakpointEventTypeAdded); + return bp_sp->GetID(); } bool BreakpointList::Remove(break_id_t break_id, bool notify) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - bp_collection::iterator pos = GetBreakpointIDIterator(break_id); // Predicate - if (pos != m_breakpoints.end()) { - BreakpointSP bp_sp(*pos); - m_breakpoints.erase(pos); - if (notify) { - if (bp_sp->GetTarget().EventTypeHasListeners( - Target::eBroadcastBitBreakpointChanged)) - bp_sp->GetTarget().BroadcastEvent( - Target::eBroadcastBitBreakpointChanged, - new Breakpoint::BreakpointEventData(eBreakpointEventTypeRemoved, - bp_sp)); - } - return true; - } - return false; + + auto it = std::find_if( + m_breakpoints.begin(), m_breakpoints.end(), + [&](const BreakpointSP &bp) { return bp->GetID() == break_id; }); + + if (it == m_breakpoints.end()) + return false; + + if (notify) + NotifyChange(*it, eBreakpointEventTypeRemoved); + + m_breakpoints.erase(it); + + return true; } void BreakpointList::RemoveInvalidLocations(const ArchSpec &arch) { @@ -83,93 +83,50 @@ void BreakpointList::RemoveAll(bool notify) { ClearAllBreakpointSites(); if (notify) { - bp_collection::iterator pos, end = m_breakpoints.end(); - for (pos = m_breakpoints.begin(); pos != end; ++pos) { - if ((*pos)->GetTarget().EventTypeHasListeners( - Target::eBroadcastBitBreakpointChanged)) { - (*pos)->GetTarget().BroadcastEvent( - Target::eBroadcastBitBreakpointChanged, - new Breakpoint::BreakpointEventData(eBreakpointEventTypeRemoved, - *pos)); - } - } + for (const auto &bp_sp : m_breakpoints) + NotifyChange(bp_sp, eBreakpointEventTypeRemoved); } - m_breakpoints.erase(m_breakpoints.begin(), m_breakpoints.end()); + + m_breakpoints.clear(); } void BreakpointList::RemoveAllowed(bool notify) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - bp_collection::iterator pos, end = m_breakpoints.end(); - if (notify) { - for (pos = m_breakpoints.begin(); pos != end; ++pos) { - if(!(*pos)->AllowDelete()) - continue; - if ((*pos)->GetTarget().EventTypeHasListeners( - Target::eBroadcastBitBreakpointChanged)) { - (*pos)->GetTarget().BroadcastEvent( - Target::eBroadcastBitBreakpointChanged, - new Breakpoint::BreakpointEventData(eBreakpointEventTypeRemoved, - *pos)); - } - } - } - pos = m_breakpoints.begin(); - while ( pos != end) { - auto bp = *pos; - if (bp->AllowDelete()) { - bp->ClearAllBreakpointSites(); - pos = m_breakpoints.erase(pos); - } else - pos++; + for (const auto &bp_sp : m_breakpoints) { + if (bp_sp->AllowDelete()) + bp_sp->ClearAllBreakpointSites(); + if (notify) + NotifyChange(bp_sp, eBreakpointEventTypeRemoved); } -} - -class BreakpointIDMatches { -public: - BreakpointIDMatches(break_id_t break_id) : m_break_id(break_id) {} - bool operator()(const BreakpointSP &bp) const { - return m_break_id == bp->GetID(); - } - -private: - const break_id_t m_break_id; -}; + m_breakpoints.erase( + std::remove_if(m_breakpoints.begin(), m_breakpoints.end(), + [&](const BreakpointSP &bp) { return bp->AllowDelete(); }), + m_breakpoints.end()); +} BreakpointList::bp_collection::iterator BreakpointList::GetBreakpointIDIterator(break_id_t break_id) { - return std::find_if(m_breakpoints.begin(), - m_breakpoints.end(), // Search full range - BreakpointIDMatches(break_id)); // Predicate + return std::find_if( + m_breakpoints.begin(), m_breakpoints.end(), + [&](const BreakpointSP &bp) { return bp->GetID() == break_id; }); } BreakpointList::bp_collection::const_iterator BreakpointList::GetBreakpointIDConstIterator(break_id_t break_id) const { - return std::find_if(m_breakpoints.begin(), - m_breakpoints.end(), // Search full range - BreakpointIDMatches(break_id)); // Predicate -} - -BreakpointSP BreakpointList::FindBreakpointByID(break_id_t break_id) { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - BreakpointSP stop_sp; - bp_collection::iterator pos = GetBreakpointIDIterator(break_id); - if (pos != m_breakpoints.end()) - stop_sp = *pos; - - return stop_sp; + return std::find_if( + m_breakpoints.begin(), m_breakpoints.end(), + [&](const BreakpointSP &bp) { return bp->GetID() == break_id; }); } -const BreakpointSP -BreakpointList::FindBreakpointByID(break_id_t break_id) const { +BreakpointSP BreakpointList::FindBreakpointByID(break_id_t break_id) const { std::lock_guard<std::recursive_mutex> guard(m_mutex); - BreakpointSP stop_sp; - bp_collection::const_iterator pos = GetBreakpointIDConstIterator(break_id); - if (pos != m_breakpoints.end()) - stop_sp = *pos; - return stop_sp; + auto it = GetBreakpointIDConstIterator(break_id); + if (it != m_breakpoints.end()) + return *it; + return {}; } bool BreakpointList::FindBreakpointsByName(const char *name, @@ -186,6 +143,7 @@ bool BreakpointList::FindBreakpointsByName(const char *name, matching_bps.Add(bkpt_sp, false); } } + return true; } @@ -201,30 +159,11 @@ void BreakpointList::Dump(Stream *s) const { s->IndentLess(); } -BreakpointSP BreakpointList::GetBreakpointAtIndex(size_t i) { +BreakpointSP BreakpointList::GetBreakpointAtIndex(size_t i) const { std::lock_guard<std::recursive_mutex> guard(m_mutex); - BreakpointSP stop_sp; - bp_collection::iterator end = m_breakpoints.end(); - bp_collection::iterator pos; - size_t curr_i = 0; - for (pos = m_breakpoints.begin(), curr_i = 0; pos != end; ++pos, ++curr_i) { - if (curr_i == i) - stop_sp = *pos; - } - return stop_sp; -} - -const BreakpointSP BreakpointList::GetBreakpointAtIndex(size_t i) const { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - BreakpointSP stop_sp; - bp_collection::const_iterator end = m_breakpoints.end(); - bp_collection::const_iterator pos; - size_t curr_i = 0; - for (pos = m_breakpoints.begin(), curr_i = 0; pos != end; ++pos, ++curr_i) { - if (curr_i == i) - stop_sp = *pos; - } - return stop_sp; + if (i < m_breakpoints.size()) + return m_breakpoints[i]; + return {}; } void BreakpointList::UpdateBreakpoints(ModuleList &module_list, bool added, diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp index 932147703304..5d3763a367c3 100644 --- a/source/Breakpoint/BreakpointLocation.cpp +++ b/source/Breakpoint/BreakpointLocation.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/BreakpointID.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" diff --git a/source/Breakpoint/BreakpointLocationCollection.cpp b/source/Breakpoint/BreakpointLocationCollection.cpp index 6536002bda67..27957a50d2b0 100644 --- a/source/Breakpoint/BreakpointLocationCollection.cpp +++ b/source/Breakpoint/BreakpointLocationCollection.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointLocationCollection.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" diff --git a/source/Breakpoint/BreakpointLocationList.cpp b/source/Breakpoint/BreakpointLocationList.cpp index 23ca89da6ce1..6a3280e961cc 100644 --- a/source/Breakpoint/BreakpointLocationList.cpp +++ b/source/Breakpoint/BreakpointLocationList.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointLocationList.h" #include "lldb/Breakpoint/Breakpoint.h" diff --git a/source/Breakpoint/BreakpointName.cpp b/source/Breakpoint/BreakpointName.cpp index be4710d7849c..baf871ebbae1 100644 --- a/source/Breakpoint/BreakpointName.cpp +++ b/source/Breakpoint/BreakpointName.cpp @@ -7,12 +7,8 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes #include "llvm/Support/Casting.h" -// Project includes #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/BreakpointLocationCollection.h" diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp index b5869fc34dfc..ff497c5633b0 100644 --- a/source/Breakpoint/BreakpointOptions.cpp +++ b/source/Breakpoint/BreakpointOptions.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" diff --git a/source/Breakpoint/BreakpointResolver.cpp b/source/Breakpoint/BreakpointResolver.cpp index 6ab578dd8576..0a1eeed28954 100644 --- a/source/Breakpoint/BreakpointResolver.cpp +++ b/source/Breakpoint/BreakpointResolver.cpp @@ -9,10 +9,6 @@ #include "lldb/Breakpoint/BreakpointResolver.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" // Have to include the other breakpoint resolver types here so the static @@ -21,6 +17,7 @@ #include "lldb/Breakpoint/BreakpointResolverFileLine.h" #include "lldb/Breakpoint/BreakpointResolverFileRegex.h" #include "lldb/Breakpoint/BreakpointResolverName.h" +#include "lldb/Breakpoint/BreakpointResolverScripted.h" #include "lldb/Core/Address.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/SearchFilter.h" @@ -44,9 +41,10 @@ const char *BreakpointResolver::g_ty_to_name[] = {"FileAndLine", "Address", const char *BreakpointResolver::g_option_names[static_cast<uint32_t>( BreakpointResolver::OptionNames::LastOptionName)] = { - "AddressOffset", "Exact", "FileName", "Inlines", "Language", - "LineNumber", "ModuleName", "NameMask", "Offset", "Regex", - "SectionName", "SkipPrologue", "SymbolNames"}; + "AddressOffset", "Exact", "FileName", "Inlines", "Language", + "LineNumber", "Column", "ModuleName", "NameMask", "Offset", + "PythonClass", "Regex", "ScriptArgs", "SectionName", "SearchDepth", + "SkipPrologue", "SymbolNames"}; const char *BreakpointResolver::ResolverTyToName(enum ResolverTy type) { if (type > LastKnownResolverType) @@ -132,6 +130,10 @@ BreakpointResolverSP BreakpointResolver::CreateFromStructuredData( resolver = BreakpointResolverFileRegex::CreateFromStructuredData( nullptr, *subclass_options, error); break; + case PythonResolver: + resolver = BreakpointResolverScripted::CreateFromStructuredData( + nullptr, *subclass_options, error); + break; case ExceptionResolver: error.SetErrorString("Exception resolvers are hard."); break; @@ -165,6 +167,7 @@ StructuredData::DictionarySP BreakpointResolver::WrapOptionsDict( void BreakpointResolver::SetBreakpoint(Breakpoint *bkpt) { m_breakpoint = bkpt; + NotifyBreakpointSet(); } void BreakpointResolver::ResolveBreakpointInModules(SearchFilter &filter, @@ -176,133 +179,162 @@ void BreakpointResolver::ResolveBreakpoint(SearchFilter &filter) { filter.Search(*this); } +namespace { +struct SourceLoc { + uint32_t line = UINT32_MAX; + uint32_t column; + SourceLoc(uint32_t l, uint32_t c) : line(l), column(c ? c : UINT32_MAX) {} + SourceLoc(const SymbolContext &sc) + : line(sc.line_entry.line), + column(sc.line_entry.column ? sc.line_entry.column : UINT32_MAX) {} +}; + +bool operator<(const SourceLoc a, const SourceLoc b) { + if (a.line < b.line) + return true; + if (a.line > b.line) + return false; + uint32_t a_col = a.column ? a.column : UINT32_MAX; + uint32_t b_col = b.column ? b.column : UINT32_MAX; + return a_col < b_col; +} +} // namespace + void BreakpointResolver::SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, - llvm::StringRef log_ident) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + llvm::StringRef log_ident, + uint32_t line, uint32_t column) { + llvm::SmallVector<SymbolContext, 16> all_scs; + for (uint32_t i = 0; i < sc_list.GetSize(); ++i) + all_scs.push_back(sc_list[i]); - while (sc_list.GetSize() > 0) { - SymbolContextList tmp_sc_list; - unsigned current_idx = 0; - SymbolContext sc; - bool first_entry = true; + while (all_scs.size()) { + uint32_t closest_line = UINT32_MAX; - FileSpec match_file_spec; - FileSpec match_original_file_spec; - uint32_t closest_line_number = UINT32_MAX; - - // Pull out the first entry, and all the others that match its file spec, - // and stuff them in the tmp list. - while (current_idx < sc_list.GetSize()) { - bool matches; + // Move all the elements with a matching file spec to the end. + auto &match = all_scs[0]; + auto worklist_begin = std::partition( + all_scs.begin(), all_scs.end(), [&](const SymbolContext &sc) { + if (sc.line_entry.file == match.line_entry.file || + sc.line_entry.original_file == match.line_entry.original_file) { + // When a match is found, keep track of the smallest line number. + closest_line = std::min(closest_line, sc.line_entry.line); + return false; + } + return true; + }); - sc_list.GetContextAtIndex(current_idx, sc); - if (first_entry) { - match_file_spec = sc.line_entry.file; - match_original_file_spec = sc.line_entry.original_file; - matches = true; - first_entry = false; - } else - matches = ((sc.line_entry.file == match_file_spec) || - (sc.line_entry.original_file == match_original_file_spec)); + // (worklist_begin, worklist_end) now contains all entries for one filespec. + auto worklist_end = all_scs.end(); - if (matches) { - tmp_sc_list.Append(sc); - sc_list.RemoveContextAtIndex(current_idx); + if (column) { + // If a column was requested, do a more precise match and only + // return the first location that comes after or at the + // requested location. + SourceLoc requested(line, column); + // First, filter out all entries left of the requested column. + worklist_end = std::remove_if( + worklist_begin, worklist_end, + [&](const SymbolContext &sc) { return SourceLoc(sc) < requested; }); + // Sort the remaining entries by (line, column). + llvm::sort(worklist_begin, worklist_end, + [](const SymbolContext &a, const SymbolContext &b) { + return SourceLoc(a) < SourceLoc(b); + }); - // ResolveSymbolContext will always return a number that is >= the line - // number you pass in. So the smaller line number is always better. - if (sc.line_entry.line < closest_line_number) - closest_line_number = sc.line_entry.line; - } else - current_idx++; + // Filter out all locations with a source location after the closest match. + if (worklist_begin != worklist_end) + worklist_end = std::remove_if( + worklist_begin, worklist_end, [&](const SymbolContext &sc) { + return SourceLoc(*worklist_begin) < SourceLoc(sc); + }); + } else { + // Remove all entries with a larger line number. + // ResolveSymbolContext will always return a number that is >= + // the line number you pass in. So the smaller line number is + // always better. + worklist_end = std::remove_if(worklist_begin, worklist_end, + [&](const SymbolContext &sc) { + return closest_line != sc.line_entry.line; + }); } - // Okay, we've found the closest line number match, now throw away all the - // others: + // Sort by file address. + llvm::sort(worklist_begin, worklist_end, + [](const SymbolContext &a, const SymbolContext &b) { + return a.line_entry.range.GetBaseAddress().GetFileAddress() < + b.line_entry.range.GetBaseAddress().GetFileAddress(); + }); - current_idx = 0; - while (current_idx < tmp_sc_list.GetSize()) { - if (tmp_sc_list.GetContextAtIndex(current_idx, sc)) { - if (sc.line_entry.line != closest_line_number) - tmp_sc_list.RemoveContextAtIndex(current_idx); - else - current_idx++; - } + // Go through and see if there are line table entries that are + // contiguous, and if so keep only the first of the contiguous range. + // We do this by picking the first location in each lexical block. + llvm::SmallDenseSet<Block *, 8> blocks_with_breakpoints; + for (auto first = worklist_begin; first != worklist_end; ++first) { + assert(!blocks_with_breakpoints.count(first->block)); + blocks_with_breakpoints.insert(first->block); + worklist_end = + std::remove_if(std::next(first), worklist_end, + [&](const SymbolContext &sc) { + return blocks_with_breakpoints.count(sc.block); + }); } - // Next go through and see if there are line table entries that are - // contiguous, and if so keep only the first of the contiguous range: - - current_idx = 0; - std::map<Block *, lldb::addr_t> blocks_with_breakpoints; - - while (current_idx < tmp_sc_list.GetSize()) { - if (tmp_sc_list.GetContextAtIndex(current_idx, sc)) { - if (blocks_with_breakpoints.find(sc.block) != - blocks_with_breakpoints.end()) - tmp_sc_list.RemoveContextAtIndex(current_idx); - else { - blocks_with_breakpoints.insert(std::pair<Block *, lldb::addr_t>( - sc.block, sc.line_entry.range.GetBaseAddress().GetFileAddress())); - current_idx++; - } - } - } + // Make breakpoints out of the closest line number match. + for (auto &sc : llvm::make_range(worklist_begin, worklist_end)) + AddLocation(filter, sc, skip_prologue, log_ident); - // and make breakpoints out of the closest line number match. + // Remove all contexts processed by this iteration. + all_scs.erase(worklist_begin, all_scs.end()); + } +} - uint32_t tmp_sc_list_size = tmp_sc_list.GetSize(); +void BreakpointResolver::AddLocation(SearchFilter &filter, + const SymbolContext &sc, + bool skip_prologue, + llvm::StringRef log_ident) { + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Address line_start = sc.line_entry.range.GetBaseAddress(); + if (!line_start.IsValid()) { + if (log) + log->Printf("error: Unable to set breakpoint %s at file address " + "0x%" PRIx64 "\n", + log_ident.str().c_str(), line_start.GetFileAddress()); + return; + } - for (uint32_t i = 0; i < tmp_sc_list_size; i++) { - if (tmp_sc_list.GetContextAtIndex(i, sc)) { - Address line_start = sc.line_entry.range.GetBaseAddress(); - if (line_start.IsValid()) { - if (filter.AddressPasses(line_start)) { - // If the line number is before the prologue end, move it there... - bool skipped_prologue = false; - if (skip_prologue) { - if (sc.function) { - Address prologue_addr( - sc.function->GetAddressRange().GetBaseAddress()); - if (prologue_addr.IsValid() && (line_start == prologue_addr)) { - const uint32_t prologue_byte_size = - sc.function->GetPrologueByteSize(); - if (prologue_byte_size) { - prologue_addr.Slide(prologue_byte_size); + if (!filter.AddressPasses(line_start)) { + if (log) + log->Printf("Breakpoint %s at file address 0x%" PRIx64 + " didn't pass the filter.\n", + log_ident.str().c_str(), line_start.GetFileAddress()); + } - if (filter.AddressPasses(prologue_addr)) { - skipped_prologue = true; - line_start = prologue_addr; - } - } - } - } - } + // If the line number is before the prologue end, move it there... + bool skipped_prologue = false; + if (skip_prologue && sc.function) { + Address prologue_addr(sc.function->GetAddressRange().GetBaseAddress()); + if (prologue_addr.IsValid() && (line_start == prologue_addr)) { + const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize(); + if (prologue_byte_size) { + prologue_addr.Slide(prologue_byte_size); - BreakpointLocationSP bp_loc_sp(AddLocation(line_start)); - if (log && bp_loc_sp && !m_breakpoint->IsInternal()) { - StreamString s; - bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); - log->Printf("Added location (skipped prologue: %s): %s \n", - skipped_prologue ? "yes" : "no", s.GetData()); - } - } else if (log) { - log->Printf("Breakpoint %s at file address 0x%" PRIx64 - " didn't pass the filter.\n", - log_ident.str().c_str(), line_start.GetFileAddress()); - } - } else { - if (log) - log->Printf( - "error: Unable to set breakpoint %s at file address 0x%" PRIx64 - "\n", - log_ident.str().c_str(), line_start.GetFileAddress()); + if (filter.AddressPasses(prologue_addr)) { + skipped_prologue = true; + line_start = prologue_addr; } } } } + + BreakpointLocationSP bp_loc_sp(AddLocation(line_start)); + if (log && bp_loc_sp && !m_breakpoint->IsInternal()) { + StreamString s; + bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); + log->Printf("Added location (skipped prologue: %s): %s \n", + skipped_prologue ? "yes" : "no", s.GetData()); + } } BreakpointLocationSP BreakpointResolver::AddLocation(Address loc_addr, @@ -315,7 +347,8 @@ void BreakpointResolver::SetOffset(lldb::addr_t offset) { // There may already be an offset, so we are actually adjusting location // addresses by the difference. // lldb::addr_t slide = offset - m_offset; - // FIXME: We should go fix up all the already set locations for the new slide. + // FIXME: We should go fix up all the already set locations for the new + // slide. m_offset = offset; } diff --git a/source/Breakpoint/BreakpointResolverAddress.cpp b/source/Breakpoint/BreakpointResolverAddress.cpp index d4647e2c589d..3084ce41e8e3 100644 --- a/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/source/Breakpoint/BreakpointResolverAddress.cpp @@ -9,10 +9,6 @@ #include "lldb/Breakpoint/BreakpointResolverAddress.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Module.h" @@ -66,7 +62,7 @@ BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData( error.SetErrorString("BRA::CFSD: Couldn't read module name entry."); return nullptr; } - module_filespec.SetFile(module_name, false, FileSpec::Style::native); + module_filespec.SetFile(module_name, FileSpec::Style::native); } return new BreakpointResolverAddress(bkpt, address, module_filespec); } @@ -173,8 +169,8 @@ BreakpointResolverAddress::SearchCallback(SearchFilter &filter, return Searcher::eCallbackReturnStop; } -Searcher::Depth BreakpointResolverAddress::GetDepth() { - return Searcher::eDepthTarget; +lldb::SearchDepth BreakpointResolverAddress::GetDepth() { + return lldb::eSearchDepthTarget; } void BreakpointResolverAddress::GetDescription(Stream *s) { diff --git a/source/Breakpoint/BreakpointResolverFileLine.cpp b/source/Breakpoint/BreakpointResolverFileLine.cpp index ecef88eb9989..438f430bd2a5 100644 --- a/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -9,10 +9,6 @@ #include "lldb/Breakpoint/BreakpointResolverFileLine.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/CompileUnit.h" @@ -28,11 +24,12 @@ using namespace lldb_private; //---------------------------------------------------------------------- BreakpointResolverFileLine::BreakpointResolverFileLine( Breakpoint *bkpt, const FileSpec &file_spec, uint32_t line_no, - lldb::addr_t offset, bool check_inlines, bool skip_prologue, - bool exact_match) + uint32_t column, lldb::addr_t offset, bool check_inlines, + bool skip_prologue, bool exact_match) : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver, offset), - m_file_spec(file_spec), m_line_number(line_no), m_inlines(check_inlines), - m_skip_prologue(skip_prologue), m_exact_match(exact_match) {} + m_file_spec(file_spec), m_line_number(line_no), m_column(column), + m_inlines(check_inlines), m_skip_prologue(skip_prologue), + m_exact_match(exact_match) {} BreakpointResolverFileLine::~BreakpointResolverFileLine() {} @@ -41,6 +38,7 @@ BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( Status &error) { llvm::StringRef filename; uint32_t line_no; + uint32_t column; bool check_inlines; bool skip_prologue; bool exact_match; @@ -62,6 +60,13 @@ BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( return nullptr; } + success = + options_dict.GetValueForKeyAsInteger(GetKey(OptionNames::Column), column); + if (!success) { + // Backwards compatibility. + column = 0; + } + success = options_dict.GetValueForKeyAsBoolean(GetKey(OptionNames::Inlines), check_inlines); if (!success) { @@ -83,10 +88,10 @@ BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( return nullptr; } - FileSpec file_spec(filename, false); + FileSpec file_spec(filename); - return new BreakpointResolverFileLine(bkpt, file_spec, line_no, offset, - check_inlines, skip_prologue, + return new BreakpointResolverFileLine(bkpt, file_spec, line_no, column, + offset, check_inlines, skip_prologue, exact_match); } @@ -99,6 +104,8 @@ BreakpointResolverFileLine::SerializeToStructuredData() { m_file_spec.GetPath()); options_dict_sp->AddIntegerItem(GetKey(OptionNames::LineNumber), m_line_number); + options_dict_sp->AddIntegerItem(GetKey(OptionNames::Column), + m_column); options_dict_sp->AddBooleanItem(GetKey(OptionNames::Inlines), m_inlines); options_dict_sp->AddBooleanItem(GetKey(OptionNames::SkipPrologue), m_skip_prologue); @@ -181,8 +188,12 @@ void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list, // inline int foo2() { ... } // // but that's the best we can do for now. + // One complication, if the line number returned from GetStartLineSourceInfo + // is 0, then we can't do this calculation. That can happen if + // GetStartLineSourceInfo gets an error, or if the first line number in + // the function really is 0 - which happens for some languages. const int decl_line_is_too_late_fudge = 1; - if (m_line_number < line - decl_line_is_too_late_fudge) { + if (line && m_line_number < line - decl_line_is_too_late_fudge) { LLDB_LOG(log, "removing symbol context at {0}:{1}", file, line); sc_list.RemoveContextAtIndex(i); --i; @@ -236,18 +247,22 @@ BreakpointResolverFileLine::SearchCallback(SearchFilter &filter, s.Printf("for %s:%d ", m_file_spec.GetFilename().AsCString("<Unknown>"), m_line_number); - SetSCMatchesByLine(filter, sc_list, m_skip_prologue, s.GetString()); + SetSCMatchesByLine(filter, sc_list, m_skip_prologue, s.GetString(), + m_line_number, m_column); return Searcher::eCallbackReturnContinue; } -Searcher::Depth BreakpointResolverFileLine::GetDepth() { - return Searcher::eDepthModule; +lldb::SearchDepth BreakpointResolverFileLine::GetDepth() { + return lldb::eSearchDepthModule; } void BreakpointResolverFileLine::GetDescription(Stream *s) { - s->Printf("file = '%s', line = %u, exact_match = %d", - m_file_spec.GetPath().c_str(), m_line_number, m_exact_match); + s->Printf("file = '%s', line = %u, ", m_file_spec.GetPath().c_str(), + m_line_number); + if (m_column) + s->Printf("column = %u, ", m_column); + s->Printf("exact_match = %d", m_exact_match); } void BreakpointResolverFileLine::Dump(Stream *s) const {} @@ -255,7 +270,7 @@ void BreakpointResolverFileLine::Dump(Stream *s) const {} lldb::BreakpointResolverSP BreakpointResolverFileLine::CopyForBreakpoint(Breakpoint &breakpoint) { lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileLine( - &breakpoint, m_file_spec, m_line_number, m_offset, m_inlines, + &breakpoint, m_file_spec, m_line_number, m_column, m_offset, m_inlines, m_skip_prologue, m_exact_match)); return ret_sp; diff --git a/source/Breakpoint/BreakpointResolverFileRegex.cpp b/source/Breakpoint/BreakpointResolverFileRegex.cpp index 54c05a042468..62cf9553c82c 100644 --- a/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -9,10 +9,6 @@ #include "lldb/Breakpoint/BreakpointResolverFileRegex.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/SourceManager.h" #include "lldb/Symbol/CompileUnit.h" @@ -157,8 +153,8 @@ BreakpointResolverFileRegex::SearchCallback(SearchFilter &filter, return Searcher::eCallbackReturnContinue; } -Searcher::Depth BreakpointResolverFileRegex::GetDepth() { - return Searcher::eDepthCompUnit; +lldb::SearchDepth BreakpointResolverFileRegex::GetDepth() { + return lldb::eSearchDepthCompUnit; } void BreakpointResolverFileRegex::GetDescription(Stream *s) { diff --git a/source/Breakpoint/BreakpointResolverName.cpp b/source/Breakpoint/BreakpointResolverName.cpp index ba277ae2655e..43f7cb85a574 100644 --- a/source/Breakpoint/BreakpointResolverName.cpp +++ b/source/Breakpoint/BreakpointResolverName.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointResolverName.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" @@ -30,7 +26,7 @@ using namespace lldb; using namespace lldb_private; BreakpointResolverName::BreakpointResolverName( - Breakpoint *bkpt, const char *name_cstr, uint32_t name_type_mask, + Breakpoint *bkpt, const char *name_cstr, FunctionNameType name_type_mask, LanguageType language, Breakpoint::MatchType type, lldb::addr_t offset, bool skip_prologue) : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset), @@ -51,7 +47,7 @@ BreakpointResolverName::BreakpointResolverName( BreakpointResolverName::BreakpointResolverName( Breakpoint *bkpt, const char *names[], size_t num_names, - uint32_t name_type_mask, LanguageType language, lldb::addr_t offset, + FunctionNameType name_type_mask, LanguageType language, lldb::addr_t offset, bool skip_prologue) : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset), m_match_type(Breakpoint::Exact), m_language(language), @@ -61,9 +57,12 @@ BreakpointResolverName::BreakpointResolverName( } } -BreakpointResolverName::BreakpointResolverName( - Breakpoint *bkpt, std::vector<std::string> names, uint32_t name_type_mask, - LanguageType language, lldb::addr_t offset, bool skip_prologue) +BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt, + std::vector<std::string> names, + FunctionNameType name_type_mask, + LanguageType language, + lldb::addr_t offset, + bool skip_prologue) : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset), m_match_type(Breakpoint::Exact), m_language(language), m_skip_prologue(skip_prologue) { @@ -161,9 +160,8 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( return nullptr; } std::vector<std::string> names; - std::vector<uint32_t> name_masks; + std::vector<FunctionNameType> name_masks; for (size_t i = 0; i < num_elem; i++) { - uint32_t name_mask; llvm::StringRef name; success = names_array->GetItemAtIndexAsString(i, name); @@ -171,13 +169,14 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( error.SetErrorString("BRN::CFSD: name entry is not a string."); return nullptr; } - success = names_mask_array->GetItemAtIndexAsInteger(i, name_mask); + std::underlying_type<FunctionNameType>::type fnt; + success = names_mask_array->GetItemAtIndexAsInteger(i, fnt); if (!success) { error.SetErrorString("BRN::CFSD: name mask entry is not an integer."); return nullptr; } names.push_back(name); - name_masks.push_back(name_mask); + name_masks.push_back(static_cast<FunctionNameType>(fnt)); } BreakpointResolverName *resolver = new BreakpointResolverName( @@ -220,7 +219,7 @@ StructuredData::ObjectSP BreakpointResolverName::SerializeToStructuredData() { } void BreakpointResolverName::AddNameLookup(const ConstString &name, - uint32_t name_type_mask) { + FunctionNameType name_type_mask) { ObjCLanguage::MethodName objc_method(name.GetCString(), false); if (objc_method.IsValid(false)) { std::vector<ConstString> objc_names; @@ -396,8 +395,8 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter, return Searcher::eCallbackReturnContinue; } -Searcher::Depth BreakpointResolverName::GetDepth() { - return Searcher::eDepthModule; +lldb::SearchDepth BreakpointResolverName::GetDepth() { + return lldb::eSearchDepthModule; } void BreakpointResolverName::GetDescription(Stream *s) { diff --git a/source/Breakpoint/BreakpointResolverScripted.cpp b/source/Breakpoint/BreakpointResolverScripted.cpp new file mode 100644 index 000000000000..47940ef60703 --- /dev/null +++ b/source/Breakpoint/BreakpointResolverScripted.cpp @@ -0,0 +1,189 @@ +//===-- BreakpointResolverScripted.cpp ---------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Breakpoint/BreakpointResolverScripted.h" + + +#include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/Section.h" +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/ScriptInterpreter.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/StreamString.h" + +using namespace lldb; +using namespace lldb_private; + +//---------------------------------------------------------------------- +// BreakpointResolverScripted: +//---------------------------------------------------------------------- +BreakpointResolverScripted::BreakpointResolverScripted( + Breakpoint *bkpt, + const llvm::StringRef class_name, + lldb::SearchDepth depth, + StructuredDataImpl *args_data, + ScriptInterpreter &script_interp) + : BreakpointResolver(bkpt, BreakpointResolver::PythonResolver), + m_class_name(class_name), m_depth(depth), m_args_ptr(args_data) { + CreateImplementationIfNeeded(); +} + +void BreakpointResolverScripted::CreateImplementationIfNeeded() { + if (m_implementation_sp) + return; + + if (m_class_name.empty()) + return; + + if (m_breakpoint) { + TargetSP target_sp = m_breakpoint->GetTargetSP(); + ScriptInterpreter *script_interp = target_sp->GetDebugger() + .GetCommandInterpreter() + .GetScriptInterpreter(); + if (!script_interp) + return; + lldb::BreakpointSP bkpt_sp(m_breakpoint->shared_from_this()); + m_implementation_sp = script_interp->CreateScriptedBreakpointResolver( + m_class_name.c_str(), m_args_ptr, bkpt_sp); + } +} + +void BreakpointResolverScripted::NotifyBreakpointSet() { + CreateImplementationIfNeeded(); +} + +BreakpointResolverScripted::~BreakpointResolverScripted() {} + +BreakpointResolver * +BreakpointResolverScripted::CreateFromStructuredData( + Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + Status &error) { + llvm::StringRef class_name; + bool success; + + if (!bkpt) + return nullptr; + + success = options_dict.GetValueForKeyAsString( + GetKey(OptionNames::PythonClassName), class_name); + if (!success) { + error.SetErrorString("BRFL::CFSD: Couldn't find class name entry."); + return nullptr; + } + lldb::SearchDepth depth; + int depth_as_int; + success = options_dict.GetValueForKeyAsInteger( + GetKey(OptionNames::SearchDepth), depth_as_int); + if (!success) { + error.SetErrorString("BRFL::CFSD: Couldn't find class name entry."); + return nullptr; + } + if (depth_as_int >= (int) OptionNames::LastOptionName) { + error.SetErrorString("BRFL::CFSD: Invalid value for search depth."); + return nullptr; + } + depth = (lldb::SearchDepth) depth_as_int; + + StructuredDataImpl *args_data_impl = new StructuredDataImpl(); + StructuredData::Dictionary *args_dict = new StructuredData::Dictionary(); + success = options_dict.GetValueForKeyAsDictionary( + GetKey(OptionNames::ScriptArgs), args_dict); + if (success) { + // FIXME: The resolver needs a copy of the ARGS dict that it can own, + // so I need to make a copy constructor for the Dictionary so I can pass + // that to it here. For now the args are empty. + //StructuredData::Dictionary *dict_copy = new StructuredData::Dictionary(args_dict); + + } + ScriptInterpreter *script_interp = bkpt->GetTarget() + .GetDebugger() + .GetCommandInterpreter() + .GetScriptInterpreter(); + return new BreakpointResolverScripted(bkpt, class_name, depth, args_data_impl, + *script_interp); +} + +StructuredData::ObjectSP +BreakpointResolverScripted::SerializeToStructuredData() { + StructuredData::DictionarySP options_dict_sp( + new StructuredData::Dictionary()); + + options_dict_sp->AddStringItem(GetKey(OptionNames::PythonClassName), + m_class_name); + return WrapOptionsDict(options_dict_sp); +} + +ScriptInterpreter *BreakpointResolverScripted::GetScriptInterpreter() { + return m_breakpoint->GetTarget().GetDebugger().GetCommandInterpreter() + .GetScriptInterpreter(); +} + +Searcher::CallbackReturn +BreakpointResolverScripted::SearchCallback(SearchFilter &filter, + SymbolContext &context, Address *addr, + bool containing) { + assert(m_breakpoint != NULL); + bool should_continue = true; + if (!m_implementation_sp) + return Searcher::eCallbackReturnStop; + + ScriptInterpreter *interp = GetScriptInterpreter(); + should_continue = interp->ScriptedBreakpointResolverSearchCallback( + m_implementation_sp, + &context); + if (should_continue) + return Searcher::eCallbackReturnContinue; + else + return Searcher::eCallbackReturnStop; +} + +lldb::SearchDepth +BreakpointResolverScripted::GetDepth() { + assert(m_breakpoint != NULL); + lldb::SearchDepth depth = lldb::eSearchDepthModule; + if (m_implementation_sp) { + ScriptInterpreter *interp = GetScriptInterpreter(); + depth = interp->ScriptedBreakpointResolverSearchDepth( + m_implementation_sp); + } + return depth; +} + +void BreakpointResolverScripted::GetDescription(Stream *s) { + StructuredData::GenericSP generic_sp; + std::string short_help; + + if (m_implementation_sp) { + ScriptInterpreter *interp = GetScriptInterpreter(); + interp->GetShortHelpForCommandObject(m_implementation_sp, + short_help); + } + if (!short_help.empty()) + s->PutCString(short_help.c_str()); + else + s->Printf("python class = %s", m_class_name.c_str()); +} + +void BreakpointResolverScripted::Dump(Stream *s) const {} + +lldb::BreakpointResolverSP +BreakpointResolverScripted::CopyForBreakpoint(Breakpoint &breakpoint) { + ScriptInterpreter *script_interp = GetScriptInterpreter(); + // FIXME: Have to make a copy of the arguments from the m_args_ptr and then + // pass that to the new resolver. + lldb::BreakpointResolverSP ret_sp( + new BreakpointResolverScripted(&breakpoint, m_class_name, + m_depth, nullptr, *script_interp)); + return ret_sp; +} diff --git a/source/Breakpoint/BreakpointSite.cpp b/source/Breakpoint/BreakpointSite.cpp index a5c5136eb7a6..73c1357ce963 100644 --- a/source/Breakpoint/BreakpointSite.cpp +++ b/source/Breakpoint/BreakpointSite.cpp @@ -7,12 +7,8 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes #include <inttypes.h> -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointSite.h" #include "lldb/Breakpoint/Breakpoint.h" diff --git a/source/Breakpoint/BreakpointSiteList.cpp b/source/Breakpoint/BreakpointSiteList.cpp index 9bb9aa366106..2fe107ee3e30 100644 --- a/source/Breakpoint/BreakpointSiteList.cpp +++ b/source/Breakpoint/BreakpointSiteList.cpp @@ -9,10 +9,6 @@ #include "lldb/Breakpoint/BreakpointSiteList.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Utility/Stream.h" #include <algorithm> diff --git a/source/Breakpoint/CMakeLists.txt b/source/Breakpoint/CMakeLists.txt index f93d48579ad7..9ce3a3b93e09 100644 --- a/source/Breakpoint/CMakeLists.txt +++ b/source/Breakpoint/CMakeLists.txt @@ -13,6 +13,7 @@ add_lldb_library(lldbBreakpoint BreakpointResolverFileLine.cpp BreakpointResolverFileRegex.cpp BreakpointResolverName.cpp + BreakpointResolverScripted.cpp BreakpointSite.cpp BreakpointSiteList.cpp Stoppoint.cpp diff --git a/source/Breakpoint/Stoppoint.cpp b/source/Breakpoint/Stoppoint.cpp index dbc832b4307a..13a8b837469f 100644 --- a/source/Breakpoint/Stoppoint.cpp +++ b/source/Breakpoint/Stoppoint.cpp @@ -10,10 +10,6 @@ #include "lldb/Breakpoint/Stoppoint.h" #include "lldb/lldb-private.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes using namespace lldb; using namespace lldb_private; diff --git a/source/Breakpoint/StoppointCallbackContext.cpp b/source/Breakpoint/StoppointCallbackContext.cpp index 3d24eb78c455..828ff18c433f 100644 --- a/source/Breakpoint/StoppointCallbackContext.cpp +++ b/source/Breakpoint/StoppointCallbackContext.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/StoppointCallbackContext.h" using namespace lldb_private; diff --git a/source/Breakpoint/StoppointLocation.cpp b/source/Breakpoint/StoppointLocation.cpp index d624ddbfa519..73394668508b 100644 --- a/source/Breakpoint/StoppointLocation.cpp +++ b/source/Breakpoint/StoppointLocation.cpp @@ -9,10 +9,6 @@ #include "lldb/Breakpoint/StoppointLocation.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes using namespace lldb; using namespace lldb_private; diff --git a/source/Breakpoint/Watchpoint.cpp b/source/Breakpoint/Watchpoint.cpp index 7a936d1fb130..34daaee64ccd 100644 --- a/source/Breakpoint/Watchpoint.cpp +++ b/source/Breakpoint/Watchpoint.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" @@ -135,10 +131,7 @@ void Watchpoint::IncrementFalseAlarmsAndReviseHitCount() { bool Watchpoint::ShouldStop(StoppointCallbackContext *context) { IncrementHitCount(); - if (!IsEnabled()) - return false; - - return true; + return IsEnabled(); } void Watchpoint::GetDescription(Stream *s, lldb::DescriptionLevel level) { diff --git a/source/Breakpoint/WatchpointList.cpp b/source/Breakpoint/WatchpointList.cpp index 6497780084d9..e1e2864ba0eb 100644 --- a/source/Breakpoint/WatchpointList.cpp +++ b/source/Breakpoint/WatchpointList.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/WatchpointList.h" #include "lldb/Breakpoint/Watchpoint.h" diff --git a/source/Breakpoint/WatchpointOptions.cpp b/source/Breakpoint/WatchpointOptions.cpp index 402fee943a02..033eb66014b9 100644 --- a/source/Breakpoint/WatchpointOptions.cpp +++ b/source/Breakpoint/WatchpointOptions.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/WatchpointOptions.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" |
