diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
| commit | b60736ec1405bb0a8dd40989f67ef4c93da068ab (patch) | |
| tree | 5c43fbb7c9fc45f0f87e0e6795a86267dbd12f9d /lldb/source/Breakpoint | |
| parent | cfca06d7963fa0909f90483b42a6d7d194d01e08 (diff) | |
Diffstat (limited to 'lldb/source/Breakpoint')
| -rw-r--r-- | lldb/source/Breakpoint/Breakpoint.cpp | 21 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointID.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointIDList.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointLocation.cpp | 36 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointOptions.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointResolver.cpp | 3 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointResolverAddress.cpp | 1 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointResolverFileLine.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointResolverName.cpp | 9 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointSite.cpp | 77 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/StoppointLocation.cpp | 32 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/StoppointSite.cpp | 23 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/Watchpoint.cpp | 19 |
13 files changed, 116 insertions, 125 deletions
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 317dfa231094..d7bca308ca99 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -51,7 +51,7 @@ Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp, : m_being_created(true), m_hardware(hardware), m_target(target), m_filter_sp(filter_sp), m_resolver_sp(resolver_sp), m_options_up(new BreakpointOptions(true)), m_locations(*this), - m_resolve_indirect_symbols(resolve_indirect_symbols), m_hit_count(0) { + m_resolve_indirect_symbols(resolve_indirect_symbols), m_hit_counter() { m_being_created = false; } @@ -61,7 +61,7 @@ Breakpoint::Breakpoint(Target &new_target, const Breakpoint &source_bp) m_options_up(new BreakpointOptions(*source_bp.m_options_up)), m_locations(*this), m_resolve_indirect_symbols(source_bp.m_resolve_indirect_symbols), - m_hit_count(0) {} + m_hit_counter() {} // Destructor Breakpoint::~Breakpoint() = default; @@ -144,8 +144,7 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( bool success = breakpoint_dict->GetValueForKeyAsDictionary( BreakpointResolver::GetSerializationKey(), resolver_dict); if (!success) { - error.SetErrorStringWithFormat( - "Breakpoint data missing toplevel resolver key"); + error.SetErrorString("Breakpoint data missing toplevel resolver key"); return result_sp; } @@ -242,15 +241,12 @@ bool Breakpoint::SerializedBreakpointMatchesNames( return false; size_t num_names = names_array->GetSize(); - std::vector<std::string>::iterator begin = names.begin(); - std::vector<std::string>::iterator end = names.end(); for (size_t i = 0; i < num_names; i++) { llvm::StringRef name; if (names_array->GetItemAtIndexAsString(i, name)) { - if (std::find(begin, end, name) != end) { + if (llvm::is_contained(names, name)) return true; - } } } return false; @@ -342,7 +338,7 @@ bool Breakpoint::IgnoreCountShouldStop() { return true; } -uint32_t Breakpoint::GetHitCount() const { return m_hit_count; } +uint32_t Breakpoint::GetHitCount() const { return m_hit_counter.GetValue(); } bool Breakpoint::IsOneShot() const { return m_options_up->IsOneShot(); } @@ -512,7 +508,6 @@ void Breakpoint::ModulesChanged(ModuleList &module_list, bool load, "delete_locations: %i\n", module_list.GetSize(), load, delete_locations); - std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex()); if (load) { // The logic for handling new modules is: // 1) If the filter rejects this module, then skip it. 2) Run through the @@ -529,7 +524,7 @@ void Breakpoint::ModulesChanged(ModuleList &module_list, bool load, // them after the locations pass. Have to do it this way because resolving // breakpoints will add new locations potentially. - for (ModuleSP module_sp : module_list.ModulesNoLocking()) { + for (ModuleSP module_sp : module_list.Modules()) { bool seen = false; if (!m_filter_sp->ModulePasses(module_sp)) continue; @@ -593,9 +588,7 @@ void Breakpoint::ModulesChanged(ModuleList &module_list, bool load, else removed_locations_event = nullptr; - size_t num_modules = module_list.GetSize(); - for (size_t i = 0; i < num_modules; i++) { - ModuleSP module_sp(module_list.GetModuleAtIndexUnlocked(i)); + for (ModuleSP module_sp : module_list.Modules()) { if (m_filter_sp->ModulePasses(module_sp)) { size_t loc_idx = 0; size_t num_locations = m_locations.GetSize(); diff --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp index 293baf4ad1c7..a37abcfa52ab 100644 --- a/lldb/source/Breakpoint/BreakpointID.cpp +++ b/lldb/source/Breakpoint/BreakpointID.cpp @@ -96,7 +96,7 @@ bool BreakpointID::StringIsBreakpointName(llvm::StringRef str, Status &error) { error.Clear(); if (str.empty()) { - error.SetErrorStringWithFormat("Empty breakpoint names are not allowed"); + error.SetErrorString("Empty breakpoint names are not allowed"); return false; } diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 705bc5ee1c8d..e6a5dceeb93b 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -220,10 +220,10 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target, ((start_loc_id != LLDB_INVALID_BREAK_ID) && (end_loc_id == LLDB_INVALID_BREAK_ID))) { new_args.Clear(); - result.AppendErrorWithFormat("Invalid breakpoint id range: Either " - "both ends of range must specify" - " a breakpoint location, or neither can " - "specify a breakpoint location.\n"); + result.AppendError("Invalid breakpoint id range: Either " + "both ends of range must specify" + " a breakpoint location, or neither can " + "specify a breakpoint location."); result.SetStatus(eReturnStatusFailed); return; } diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 93d54c051ee5..d3d6ea08bdb3 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -31,11 +31,10 @@ using namespace lldb_private; BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner, const Address &addr, lldb::tid_t tid, bool hardware, bool check_for_resolver) - : StoppointLocation(loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), - hardware), - m_being_created(true), m_should_resolve_indirect_functions(false), + : m_being_created(true), m_should_resolve_indirect_functions(false), m_is_reexported(false), m_is_indirect(false), m_address(addr), - m_owner(owner), m_options_up(), m_bp_site_sp(), m_condition_mutex() { + m_owner(owner), m_options_up(), m_bp_site_sp(), m_condition_mutex(), + m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() { if (check_for_resolver) { Symbol *symbol = m_address.CalculateSymbolContextSymbol(); if (symbol && symbol->IsIndirect()) { @@ -332,7 +331,7 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, return ret; } -uint32_t BreakpointLocation::GetIgnoreCount() { +uint32_t BreakpointLocation::GetIgnoreCount() const { return GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount) ->GetIgnoreCount(); } @@ -417,16 +416,16 @@ bool BreakpointLocation::ShouldStop(StoppointCallbackContext *context) { void BreakpointLocation::BumpHitCount() { if (IsEnabled()) { // Step our hit count, and also step the hit count of the owner. - IncrementHitCount(); - m_owner.IncrementHitCount(); + m_hit_counter.Increment(); + m_owner.m_hit_counter.Increment(); } } void BreakpointLocation::UndoBumpHitCount() { if (IsEnabled()) { // Step our hit count, and also step the hit count of the owner. - DecrementHitCount(); - m_owner.DecrementHitCount(); + m_hit_counter.Decrement(); + m_owner.m_hit_counter.Decrement(); } } @@ -593,12 +592,15 @@ void BreakpointLocation::GetDescription(Stream *s, } } + bool is_resolved = IsResolved(); + bool is_hardware = is_resolved && m_bp_site_sp->IsHardware(); + if (level == lldb::eDescriptionLevelVerbose) { s->EOL(); s->Indent(); - s->Printf("resolved = %s\n", IsResolved() ? "true" : "false"); + s->Printf("resolved = %s\n", is_resolved ? "true" : "false"); s->Indent(); - s->Printf("hardware = %s\n", IsHardware() ? "true" : "false"); + s->Printf("hardware = %s\n", is_hardware ? "true" : "false"); s->Indent(); s->Printf("hit count = %-4u\n", GetHitCount()); @@ -609,8 +611,8 @@ void BreakpointLocation::GetDescription(Stream *s, } s->IndentLess(); } else if (level != eDescriptionLevelInitial) { - s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"), - (IsHardware() ? "hardware, " : ""), GetHitCount()); + s->Printf(", %sresolved, %shit count = %u ", (is_resolved ? "" : "un"), + (is_hardware ? "hardware, " : ""), GetHitCount()); if (m_options_up) { m_options_up->GetDescription(s, level); } @@ -621,6 +623,11 @@ void BreakpointLocation::Dump(Stream *s) const { if (s == nullptr) return; + bool is_resolved = IsResolved(); + bool is_hardware = is_resolved && m_bp_site_sp->IsHardware(); + auto hardware_index = is_resolved ? + m_bp_site_sp->GetHardwareIndex() : LLDB_INVALID_INDEX32; + lldb::tid_t tid = GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec) ->GetThreadSpecNoCreate()->GetTID(); s->Printf("BreakpointLocation %u: tid = %4.4" PRIx64 @@ -631,8 +638,7 @@ void BreakpointLocation::Dump(Stream *s) const { (m_options_up ? m_options_up->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled", - IsHardware() ? "hardware" : "software", GetHardwareIndex(), - GetHitCount(), + is_hardware ? "hardware" : "software", hardware_index, GetHitCount(), GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount) ->GetIgnoreCount()); } diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index 0ce7b0f852e8..f6bb7633d0a9 100644 --- a/lldb/source/Breakpoint/BreakpointOptions.cpp +++ b/lldb/source/Breakpoint/BreakpointOptions.cpp @@ -319,7 +319,7 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData( else { ScriptInterpreter *interp = target.GetDebugger().GetScriptInterpreter(); if (!interp) { - error.SetErrorStringWithFormat( + error.SetErrorString( "Can't set script commands - no script interpreter"); return nullptr; } diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp index 7c03a0745ac6..cfd073367b00 100644 --- a/lldb/source/Breakpoint/BreakpointResolver.cpp +++ b/lldb/source/Breakpoint/BreakpointResolver.cpp @@ -81,8 +81,7 @@ BreakpointResolverSP BreakpointResolver::CreateFromStructuredData( GetSerializationSubclassKey(), subclass_name); if (!success) { - error.SetErrorStringWithFormat( - "Resolver data missing subclass resolver key"); + error.SetErrorString("Resolver data missing subclass resolver key"); return result_sp; } diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp index 2c56912b56af..3187e8464f6f 100644 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -87,7 +87,6 @@ BreakpointResolverAddress::SerializeToStructuredData() { } return WrapOptionsDict(options_dict_sp); - return StructuredData::ObjectSP(); } void BreakpointResolverAddress::ResolveBreakpoint(SearchFilter &filter) { diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 22a4b4ae33ae..5ca4ef5834e0 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -187,6 +187,14 @@ void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list, // 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. + + // But only do this calculation if the line number we found in the SC + // was different from the one requested in the source file. If we actually + // found an exact match it must be valid. + + if (m_line_number == sc.line_entry.line) + continue; + const int decl_line_is_too_late_fudge = 1; if (line && m_line_number < line - decl_line_is_too_late_fudge) { LLDB_LOG(log, "removing symbol context at {0}:{1}", file, line); diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index 25f5bb3f6eed..6fab20af5e59 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -108,7 +108,7 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( success = options_dict.GetValueForKeyAsInteger(GetKey(OptionNames::Offset), offset); if (!success) { - error.SetErrorStringWithFormat("BRN::CFSD: Missing offset entry."); + error.SetErrorString("BRN::CFSD: Missing offset entry."); return nullptr; } @@ -116,7 +116,7 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( success = options_dict.GetValueForKeyAsBoolean( GetKey(OptionNames::SkipPrologue), skip_prologue); if (!success) { - error.SetErrorStringWithFormat("BRN::CFSD: Missing Skip prologue entry."); + error.SetErrorString("BRN::CFSD: Missing Skip prologue entry."); return nullptr; } @@ -131,15 +131,14 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( success = options_dict.GetValueForKeyAsArray( GetKey(OptionNames::SymbolNameArray), names_array); if (!success) { - error.SetErrorStringWithFormat("BRN::CFSD: Missing symbol names entry."); + error.SetErrorString("BRN::CFSD: Missing symbol names entry."); return nullptr; } StructuredData::Array *names_mask_array; success = options_dict.GetValueForKeyAsArray( GetKey(OptionNames::NameMaskArray), names_mask_array); if (!success) { - error.SetErrorStringWithFormat( - "BRN::CFSD: Missing symbol names mask entry."); + error.SetErrorString("BRN::CFSD: Missing symbol names mask entry."); return nullptr; } diff --git a/lldb/source/Breakpoint/BreakpointSite.cpp b/lldb/source/Breakpoint/BreakpointSite.cpp index a33fd0a1c462..fb3f0cd06897 100644 --- a/lldb/source/Breakpoint/BreakpointSite.cpp +++ b/lldb/source/Breakpoint/BreakpointSite.cpp @@ -21,7 +21,7 @@ using namespace lldb_private; BreakpointSite::BreakpointSite(BreakpointSiteList *list, const BreakpointLocationSP &owner, lldb::addr_t addr, bool use_hardware) - : StoppointLocation(GetNextID(), addr, 0, use_hardware), + : StoppointSite(GetNextID(), addr, 0, use_hardware), m_type(eSoftware), // Process subclasses need to set this correctly using // SetType() m_saved_opcode(), m_trap_opcode(), @@ -48,7 +48,7 @@ break_id_t BreakpointSite::GetNextID() { // should continue. bool BreakpointSite::ShouldStop(StoppointCallbackContext *context) { - IncrementHitCount(); + m_hit_counter.Increment(); // ShouldStop can do a lot of work, and might even come come back and hit // this breakpoint site again. So don't hold the m_owners_mutex the whole // while. Instead make a local copy of the collection and call ShouldStop on @@ -156,51 +156,46 @@ void BreakpointSite::BumpHitCounts() { } } -void BreakpointSite::SetHardwareIndex(uint32_t index) { - std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); - for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations()) { - loc_sp->SetHardwareIndex(index); - } -} - bool BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size, lldb::addr_t *intersect_addr, size_t *intersect_size, size_t *opcode_offset) const { - // We only use software traps for software breakpoints - if (!IsHardware()) { - if (m_byte_size > 0) { - const lldb::addr_t bp_end_addr = m_addr + m_byte_size; - const lldb::addr_t end_addr = addr + size; - // Is the breakpoint end address before the passed in start address? - if (bp_end_addr <= addr) - return false; - // Is the breakpoint start address after passed in end address? - if (end_addr <= m_addr) - return false; - if (intersect_addr || intersect_size || opcode_offset) { - if (m_addr < addr) { - if (intersect_addr) - *intersect_addr = addr; - if (intersect_size) - *intersect_size = - std::min<lldb::addr_t>(bp_end_addr, end_addr) - addr; - if (opcode_offset) - *opcode_offset = addr - m_addr; - } else { - if (intersect_addr) - *intersect_addr = m_addr; - if (intersect_size) - *intersect_size = - std::min<lldb::addr_t>(bp_end_addr, end_addr) - m_addr; - if (opcode_offset) - *opcode_offset = 0; - } - } - return true; + // The function should be called only for software breakpoints. + lldbassert(GetType() == Type::eSoftware); + + if (m_byte_size == 0) + return false; + + const lldb::addr_t bp_end_addr = m_addr + m_byte_size; + const lldb::addr_t end_addr = addr + size; + // Is the breakpoint end address before the passed in start address? + if (bp_end_addr <= addr) + return false; + + // Is the breakpoint start address after passed in end address? + if (end_addr <= m_addr) + return false; + + if (intersect_addr || intersect_size || opcode_offset) { + if (m_addr < addr) { + if (intersect_addr) + *intersect_addr = addr; + if (intersect_size) + *intersect_size = + std::min<lldb::addr_t>(bp_end_addr, end_addr) - addr; + if (opcode_offset) + *opcode_offset = addr - m_addr; + } else { + if (intersect_addr) + *intersect_addr = m_addr; + if (intersect_size) + *intersect_size = + std::min<lldb::addr_t>(bp_end_addr, end_addr) - m_addr; + if (opcode_offset) + *opcode_offset = 0; } } - return false; + return true; } size_t diff --git a/lldb/source/Breakpoint/StoppointLocation.cpp b/lldb/source/Breakpoint/StoppointLocation.cpp deleted file mode 100644 index 5bb4c7854840..000000000000 --- a/lldb/source/Breakpoint/StoppointLocation.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===-- StoppointLocation.cpp ---------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "lldb/Breakpoint/StoppointLocation.h" - - -using namespace lldb; -using namespace lldb_private; - -// StoppointLocation constructor -StoppointLocation::StoppointLocation(break_id_t bid, addr_t addr, bool hardware) - : m_loc_id(bid), m_addr(addr), m_hardware(hardware), - m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(0), m_hit_count(0) {} - -StoppointLocation::StoppointLocation(break_id_t bid, addr_t addr, - uint32_t byte_size, bool hardware) - : m_loc_id(bid), m_addr(addr), m_hardware(hardware), - m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(byte_size), - m_hit_count(0) {} - -// Destructor -StoppointLocation::~StoppointLocation() {} - -void StoppointLocation::DecrementHitCount() { - assert(m_hit_count > 0); - --m_hit_count; -} diff --git a/lldb/source/Breakpoint/StoppointSite.cpp b/lldb/source/Breakpoint/StoppointSite.cpp new file mode 100644 index 000000000000..ba8c48326bdb --- /dev/null +++ b/lldb/source/Breakpoint/StoppointSite.cpp @@ -0,0 +1,23 @@ +//===-- StoppointSite.cpp ---------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "lldb/Breakpoint/StoppointSite.h" + + +using namespace lldb; +using namespace lldb_private; + +StoppointSite::StoppointSite(break_id_t id, addr_t addr, bool hardware) + : m_id(id), m_addr(addr), m_is_hardware_required(hardware), + m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(0), m_hit_counter() {} + +StoppointSite::StoppointSite(break_id_t id, addr_t addr, + uint32_t byte_size, bool hardware) + : m_id(id), m_addr(addr), m_is_hardware_required(hardware), + m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(byte_size), + m_hit_counter() {} diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index df73c6a17230..29ae1ef3df26 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -25,7 +25,7 @@ using namespace lldb_private; Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size, const CompilerType *type, bool hardware) - : StoppointLocation(0, addr, size, hardware), m_target(target), + : StoppointSite(0, addr, size, hardware), m_target(target), m_enabled(false), m_is_hardware(hardware), m_is_watch_variable(false), m_is_ephemeral(false), m_disabled_count(0), m_watch_read(0), m_watch_write(0), m_watch_was_read(0), m_watch_was_written(0), @@ -93,9 +93,10 @@ void Watchpoint::SetWatchSpec(const std::string &str) { m_watch_spec_str = str; } -// Override default impl of StoppointLocation::IsHardware() since m_is_hardware -// member field is more accurate. -bool Watchpoint::IsHardware() const { return m_is_hardware; } +bool Watchpoint::IsHardware() const { + lldbassert(m_is_hardware || !HardwareRequired()); + return m_is_hardware; +} bool Watchpoint::IsWatchVariable() const { return m_is_watch_variable; } @@ -123,12 +124,12 @@ bool Watchpoint::CaptureWatchedValue(const ExecutionContext &exe_ctx) { void Watchpoint::IncrementFalseAlarmsAndReviseHitCount() { ++m_false_alarms; if (m_false_alarms) { - if (m_hit_count >= m_false_alarms) { - m_hit_count -= m_false_alarms; + if (m_hit_counter.GetValue() >= m_false_alarms) { + m_hit_counter.Decrement(m_false_alarms); m_false_alarms = 0; } else { - m_false_alarms -= m_hit_count; - m_hit_count = 0; + m_false_alarms -= m_hit_counter.GetValue(); + m_hit_counter.Reset(); } } } @@ -137,7 +138,7 @@ void Watchpoint::IncrementFalseAlarmsAndReviseHitCount() { // should continue. bool Watchpoint::ShouldStop(StoppointCallbackContext *context) { - IncrementHitCount(); + m_hit_counter.Increment(); return IsEnabled(); } |
