diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-03 14:10:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-07-03 14:10:23 +0000 |
| commit | 145449b1e420787bb99721a429341fa6be3adfb6 (patch) | |
| tree | 1d56ae694a6de602e348dd80165cf881a36600ed /lldb/source/Breakpoint | |
| parent | ecbca9f5fb7d7613d2b94982c4825eb0d33d6842 (diff) | |
Diffstat (limited to 'lldb/source/Breakpoint')
18 files changed, 99 insertions, 87 deletions
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index eeb8eac33567..578cf14283d9 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -19,13 +19,14 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Core/SearchFilter.h" #include "lldb/Core/Section.h" -#include "lldb/Target/SectionLoadList.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -487,7 +488,7 @@ void Breakpoint::ClearAllBreakpointSites() { void Breakpoint::ModulesChanged(ModuleList &module_list, bool load, bool delete_locations) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Breakpoint::ModulesChanged: num_modules: %zu load: %i " "delete_locations: %i\n", @@ -646,7 +647,7 @@ static bool SymbolContextsMightBeEquivalent(SymbolContext &old_sc, void Breakpoint::ModuleReplaced(ModuleSP old_module_sp, ModuleSP new_module_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Breakpoint::ModulesReplaced for %s\n", old_module_sp->GetSpecificationDescription().c_str()); // First find all the locations that are in the old module @@ -1009,10 +1010,32 @@ void Breakpoint::SendBreakpointChangedEvent(BreakpointEventData *data) { delete data; } +const char *Breakpoint::BreakpointEventTypeAsCString(BreakpointEventType type) { + switch (type) { + case eBreakpointEventTypeInvalidType: return "invalid"; + case eBreakpointEventTypeAdded: return "breakpoint added"; + case eBreakpointEventTypeRemoved: return "breakpoint removed"; + case eBreakpointEventTypeLocationsAdded: return "locations added"; + case eBreakpointEventTypeLocationsRemoved: return "locations removed"; + case eBreakpointEventTypeLocationsResolved: return "locations resolved"; + case eBreakpointEventTypeEnabled: return "breakpoint enabled"; + case eBreakpointEventTypeDisabled: return "breakpoint disabled"; + case eBreakpointEventTypeCommandChanged: return "command changed"; + case eBreakpointEventTypeConditionChanged: return "condition changed"; + case eBreakpointEventTypeIgnoreChanged: return "ignore count changed"; + case eBreakpointEventTypeThreadChanged: return "thread changed"; + case eBreakpointEventTypeAutoContinueChanged: return "autocontinue changed"; + }; + llvm_unreachable("Fully covered switch above!"); +} + +Log *Breakpoint::BreakpointEventData::GetLogChannel() { + return GetLog(LLDBLog::Breakpoints); +} + Breakpoint::BreakpointEventData::BreakpointEventData( BreakpointEventType sub_type, const BreakpointSP &new_breakpoint_sp) - : EventData(), m_breakpoint_event(sub_type), - m_new_breakpoint_sp(new_breakpoint_sp) {} + : m_breakpoint_event(sub_type), m_new_breakpoint_sp(new_breakpoint_sp) {} Breakpoint::BreakpointEventData::~BreakpointEventData() = default; @@ -1025,7 +1048,7 @@ ConstString Breakpoint::BreakpointEventData::GetFlavor() const { return BreakpointEventData::GetFlavorString(); } -BreakpointSP &Breakpoint::BreakpointEventData::GetBreakpoint() { +BreakpointSP Breakpoint::BreakpointEventData::GetBreakpoint() const { return m_new_breakpoint_sp; } @@ -1034,7 +1057,14 @@ Breakpoint::BreakpointEventData::GetBreakpointEventType() const { return m_breakpoint_event; } -void Breakpoint::BreakpointEventData::Dump(Stream *s) const {} +void Breakpoint::BreakpointEventData::Dump(Stream *s) const { + if (!s) + return; + BreakpointEventType event_type = GetBreakpointEventType(); + break_id_t bkpt_id = GetBreakpoint()->GetID(); + s->Format("bkpt: {0} type: {1}", bkpt_id, + BreakpointEventTypeAsCString(event_type)); +} const Breakpoint::BreakpointEventData * Breakpoint::BreakpointEventData::GetEventDataFromEvent(const Event *event) { diff --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp index 9bd22898196e..245cf7913335 100644 --- a/lldb/source/Breakpoint/BreakpointID.cpp +++ b/lldb/source/Breakpoint/BreakpointID.cpp @@ -33,7 +33,7 @@ bool BreakpointID::IsRangeIdentifier(llvm::StringRef str) { } bool BreakpointID::IsValidIDExpression(llvm::StringRef str) { - return BreakpointID::ParseCanonicalReference(str).hasValue(); + return BreakpointID::ParseCanonicalReference(str).has_value(); } llvm::ArrayRef<llvm::StringRef> BreakpointID::GetRangeSpecifiers() { diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 172674dc2dd2..dd16d3b6388c 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -52,7 +52,7 @@ bool BreakpointIDList::AddBreakpointID(BreakpointID bp_id) { bool BreakpointIDList::AddBreakpointID(const char *bp_id_str) { auto bp_id = BreakpointID::ParseCanonicalReference(bp_id_str); - if (!bp_id.hasValue()) + if (!bp_id) return false; m_breakpoint_ids.push_back(*bp_id); @@ -76,7 +76,7 @@ bool BreakpointIDList::FindBreakpointID(BreakpointID &bp_id, bool BreakpointIDList::FindBreakpointID(const char *bp_id_str, size_t *position) const { auto bp_id = BreakpointID::ParseCanonicalReference(bp_id_str); - if (!bp_id.hasValue()) + if (!bp_id) return false; return FindBreakpointID(*bp_id, position); @@ -89,7 +89,7 @@ void BreakpointIDList::InsertStringArray( for (const char *str : string_array) { auto bp_id = BreakpointID::ParseCanonicalReference(str); - if (bp_id.hasValue()) + if (bp_id) m_breakpoint_ids.push_back(*bp_id); } result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -163,7 +163,7 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target, BreakpointSP breakpoint_sp; auto bp_id = BreakpointID::ParseCanonicalReference(bp_id_str); - if (bp_id.hasValue()) + if (bp_id) breakpoint_sp = target->GetBreakpointByID(bp_id->GetBreakpointID()); if (!breakpoint_sp) { new_args.Clear(); @@ -192,7 +192,7 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target, auto start_bp = BreakpointID::ParseCanonicalReference(range_from); auto end_bp = BreakpointID::ParseCanonicalReference(range_to); - if (!start_bp.hasValue() || + if (!start_bp || !target->GetBreakpointByID(start_bp->GetBreakpointID())) { new_args.Clear(); result.AppendErrorWithFormat("'%s' is not a valid breakpoint ID.\n", @@ -200,7 +200,7 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target, return; } - if (!end_bp.hasValue() || + if (!end_bp || !target->GetBreakpointByID(end_bp->GetBreakpointID())) { new_args.Clear(); result.AppendErrorWithFormat("'%s' is not a valid breakpoint ID.\n", diff --git a/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp index ca181ee306a4..f4d4b2edbf08 100644 --- a/lldb/source/Breakpoint/BreakpointList.cpp +++ b/lldb/source/Breakpoint/BreakpointList.cpp @@ -23,8 +23,7 @@ static void NotifyChange(const BreakpointSP &bp, BreakpointEventType event) { } BreakpointList::BreakpointList(bool is_internal) - : m_mutex(), m_breakpoints(), m_next_break_id(0), - m_is_internal(is_internal) {} + : m_next_break_id(0), m_is_internal(is_internal) {} BreakpointList::~BreakpointList() = default; diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 0c4d3e052c53..0ee8bcf491ea 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -22,6 +22,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadSpec.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" @@ -33,8 +34,7 @@ BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner, bool hardware, bool check_for_resolver) : 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_condition_hash(0), m_loc_id(loc_id), m_hit_counter() { + m_owner(owner), 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()) { @@ -233,7 +233,7 @@ const char *BreakpointLocation::GetConditionText(size_t *hash) const { bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, Status &error) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); std::lock_guard<std::mutex> guard(m_condition_mutex); @@ -393,7 +393,7 @@ bool BreakpointLocation::ValidForThisThread(Thread &thread) { bool BreakpointLocation::ShouldStop(StoppointCallbackContext *context) { bool should_stop = true; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); // Do this first, if a location is disabled, it shouldn't increment its hit // count. @@ -450,7 +450,7 @@ bool BreakpointLocation::ResolveBreakpointSite() { process->CreateBreakpointSite(shared_from_this(), m_owner.IsHardware()); if (new_id == LLDB_INVALID_BREAK_ID) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); if (log) log->Warning("Failed to add breakpoint site at 0x%" PRIx64, m_address.GetOpcodeLoadAddress(&m_owner.GetTarget())); diff --git a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp index 6c55629b5aad..d649e889c3f7 100644 --- a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp +++ b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp @@ -17,8 +17,7 @@ using namespace lldb; using namespace lldb_private; // BreakpointLocationCollection constructor -BreakpointLocationCollection::BreakpointLocationCollection() - : m_break_loc_collection(), m_collection_mutex() {} +BreakpointLocationCollection::BreakpointLocationCollection() = default; // Destructor BreakpointLocationCollection::~BreakpointLocationCollection() = default; @@ -123,8 +122,11 @@ bool BreakpointLocationCollection::ShouldStop( 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 can remove the breakpoint from the list, or even delete + // it, so we should + BreakpointLocationSP cur_loc_sp = GetByIndex(i); + BreakpointSP keep_bkpt_alive_sp = cur_loc_sp->GetBreakpoint().shared_from_this(); + if (cur_loc_sp->ShouldStop(context)) shouldStop = true; if (prev_size == GetSize()) diff --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp b/lldb/source/Breakpoint/BreakpointLocationList.cpp index 6d271864c445..46f66276d28d 100644 --- a/lldb/source/Breakpoint/BreakpointLocationList.cpp +++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp @@ -20,8 +20,7 @@ using namespace lldb; using namespace lldb_private; BreakpointLocationList::BreakpointLocationList(Breakpoint &owner) - : m_owner(owner), m_locations(), m_address_to_location(), m_mutex(), - m_next_id(0), m_new_location_recorder(nullptr) {} + : m_owner(owner), m_next_id(0), m_new_location_recorder(nullptr) {} BreakpointLocationList::~BreakpointLocationList() = default; diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index 86a7c483df83..6fc6948aaccc 100644 --- a/lldb/source/Breakpoint/BreakpointOptions.cpp +++ b/lldb/source/Breakpoint/BreakpointOptions.cpp @@ -60,14 +60,10 @@ std::unique_ptr<BreakpointOptions::CommandData> BreakpointOptions::CommandData::CreateFromStructuredData( const StructuredData::Dictionary &options_dict, Status &error) { std::unique_ptr<CommandData> data_up(new CommandData()); - bool found_something = false; bool success = options_dict.GetValueForKeyAsBoolean( GetKey(OptionNames::StopOnError), data_up->stop_on_error); - if (success) - found_something = true; - llvm::StringRef interpreter_str; ScriptLanguage interp_language; success = options_dict.GetValueForKeyAsString( @@ -78,7 +74,6 @@ BreakpointOptions::CommandData::CreateFromStructuredData( return data_up; } - found_something = true; interp_language = ScriptInterpreter::StringToLanguage(interpreter_str); if (interp_language == eScriptLanguageUnknown) { error.SetErrorStringWithFormatv("Unknown breakpoint command language: {0}.", @@ -91,7 +86,6 @@ BreakpointOptions::CommandData::CreateFromStructuredData( success = options_dict.GetValueForKeyAsArray(GetKey(OptionNames::UserSource), user_source); if (success) { - found_something = true; size_t num_elems = user_source->GetSize(); for (size_t i = 0; i < num_elems; i++) { llvm::StringRef elem_string; @@ -101,10 +95,7 @@ BreakpointOptions::CommandData::CreateFromStructuredData( } } - if (found_something) - return data_up; - else - return std::unique_ptr<BreakpointOptions::CommandData>(); + return data_up; } const char *BreakpointOptions::g_option_names[( @@ -121,11 +112,10 @@ bool BreakpointOptions::NullCallback(void *baton, // BreakpointOptions constructor BreakpointOptions::BreakpointOptions(bool all_flags_set) - : m_callback(BreakpointOptions::NullCallback), m_callback_baton_sp(), + : m_callback(BreakpointOptions::NullCallback), m_baton_is_command_baton(false), m_callback_is_synchronous(false), - m_enabled(true), m_one_shot(false), m_ignore_count(0), m_thread_spec_up(), - m_condition_text(), m_condition_text_hash(0), m_auto_continue(false), - m_set_flags(0) { + m_enabled(true), m_one_shot(false), m_ignore_count(0), + m_condition_text_hash(0), m_auto_continue(false), m_set_flags(0) { if (all_flags_set) m_set_flags.Set(~((Flags::ValueType)0)); } @@ -151,8 +141,8 @@ BreakpointOptions::BreakpointOptions(const BreakpointOptions &rhs) m_baton_is_command_baton(rhs.m_baton_is_command_baton), m_callback_is_synchronous(rhs.m_callback_is_synchronous), m_enabled(rhs.m_enabled), m_one_shot(rhs.m_one_shot), - m_ignore_count(rhs.m_ignore_count), m_thread_spec_up(), - m_auto_continue(rhs.m_auto_continue), m_set_flags(rhs.m_set_flags) { + m_ignore_count(rhs.m_ignore_count), m_auto_continue(rhs.m_auto_continue), + m_set_flags(rhs.m_set_flags) { if (rhs.m_thread_spec_up != nullptr) m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up); m_condition_text = rhs.m_condition_text; diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp index d3d57a282d09..71cbb2b2c666 100644 --- a/lldb/source/Breakpoint/BreakpointResolver.cpp +++ b/lldb/source/Breakpoint/BreakpointResolver.cpp @@ -24,6 +24,7 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -108,8 +109,7 @@ BreakpointResolverSP BreakpointResolver::CreateFromStructuredData( return result_sp; } - BreakpointResolver *resolver; - + BreakpointResolver *resolver = nullptr; switch (resolver_type) { case FileLineResolver: resolver = BreakpointResolverFileLine::CreateFromStructuredData( @@ -138,13 +138,12 @@ BreakpointResolverSP BreakpointResolver::CreateFromStructuredData( llvm_unreachable("Should never get an unresolvable resolver type."); } - if (!error.Success()) { + if (!resolver || error.Fail()) return result_sp; - } else { - // Add on the global offset option: - resolver->SetOffset(offset); - return BreakpointResolverSP(resolver); - } + + // Add on the global offset option: + resolver->SetOffset(offset); + return BreakpointResolverSP(resolver); } StructuredData::DictionarySP BreakpointResolver::WrapOptionsDict( @@ -292,7 +291,7 @@ void BreakpointResolver::AddLocation(SearchFilter &filter, const SymbolContext &sc, bool skip_prologue, llvm::StringRef log_ident) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); Address line_start = sc.line_entry.range.GetBaseAddress(); if (!line_start.IsValid()) { LLDB_LOGF(log, diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp index 3187e8464f6f..c173fc0c2a7a 100644 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -7,14 +7,12 @@ //===----------------------------------------------------------------------===// #include "lldb/Breakpoint/BreakpointResolverAddress.h" - - #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -30,8 +28,7 @@ BreakpointResolverAddress::BreakpointResolverAddress( BreakpointResolverAddress::BreakpointResolverAddress(const BreakpointSP &bkpt, const Address &addr) : BreakpointResolver(bkpt, BreakpointResolver::AddressResolver), - m_addr(addr), m_resolved_addr(LLDB_INVALID_ADDRESS), m_module_filespec() { -} + m_addr(addr), m_resolved_addr(LLDB_INVALID_ADDRESS) {} BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData( const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, @@ -143,8 +140,7 @@ Searcher::CallbackReturn BreakpointResolverAddress::SearchCallback( if (bp_loc_sp && !breakpoint.IsInternal()) { StreamString s; bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); - Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Added location: %s\n", s.GetData()); } } else { diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index be4616064f9e..ff044526799c 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -12,6 +12,7 @@ #include "lldb/Core/Module.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" @@ -99,10 +100,10 @@ BreakpointResolverFileLine::SerializeToStructuredData() { options_dict_sp->AddStringItem(GetKey(OptionNames::FileName), m_location_spec.GetFileSpec().GetPath()); options_dict_sp->AddIntegerItem(GetKey(OptionNames::LineNumber), - m_location_spec.GetLine().getValueOr(0)); + m_location_spec.GetLine().value_or(0)); options_dict_sp->AddIntegerItem( GetKey(OptionNames::Column), - m_location_spec.GetColumn().getValueOr(LLDB_INVALID_COLUMN_NUMBER)); + m_location_spec.GetColumn().value_or(LLDB_INVALID_COLUMN_NUMBER)); options_dict_sp->AddBooleanItem(GetKey(OptionNames::Inlines), m_location_spec.GetCheckInlines()); options_dict_sp->AddBooleanItem(GetKey(OptionNames::ExactMatch), @@ -127,7 +128,7 @@ void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list, if (is_relative) relative_path = m_location_spec.GetFileSpec().GetDirectory().GetStringRef(); - Log * log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); for(uint32_t i = 0; i < sc_list.GetSize(); ++i) { SymbolContext sc; sc_list.GetContextAtIndex(i, sc); @@ -226,7 +227,7 @@ Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback( // file. So we go through the match list and pull out the sets that have the // same file spec in their line_entry and treat each set separately. - const uint32_t line = m_location_spec.GetLine().getValueOr(0); + const uint32_t line = m_location_spec.GetLine().value_or(0); const llvm::Optional<uint16_t> column = m_location_spec.GetColumn(); // We'll create a new SourceLocationSpec that can take into account the @@ -237,7 +238,7 @@ Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback( if (is_relative) search_file_spec.GetDirectory().Clear(); SourceLocationSpec search_location_spec( - search_file_spec, m_location_spec.GetLine().getValueOr(0), + search_file_spec, m_location_spec.GetLine().value_or(0), m_location_spec.GetColumn(), m_location_spec.GetCheckInlines(), m_location_spec.GetExactMatch()); @@ -271,7 +272,7 @@ lldb::SearchDepth BreakpointResolverFileLine::GetDepth() { void BreakpointResolverFileLine::GetDescription(Stream *s) { s->Printf("file = '%s', line = %u, ", m_location_spec.GetFileSpec().GetPath().c_str(), - m_location_spec.GetLine().getValueOr(0)); + m_location_spec.GetLine().value_or(0)); auto column = m_location_spec.GetColumn(); if (column) s->Printf("column = %u, ", *column); diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index 49087b39944d..24e36f35bef0 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -15,8 +15,9 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" -#include "lldb/Target/Target.h" #include "lldb/Target/Language.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" @@ -28,12 +29,11 @@ BreakpointResolverName::BreakpointResolverName(const BreakpointSP &bkpt, LanguageType language, Breakpoint::MatchType type, lldb::addr_t offset, bool skip_prologue) : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset), - m_class_name(), m_regex(), m_match_type(type), m_language(language), - m_skip_prologue(skip_prologue) { + m_match_type(type), m_language(language), m_skip_prologue(skip_prologue) { if (m_match_type == Breakpoint::Regexp) { m_regex = RegularExpression(name_cstr); if (!m_regex.IsValid()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); if (log) log->Warning("function name regexp: \"%s\" did not compile.", @@ -252,7 +252,7 @@ void BreakpointResolverName::AddNameLookup(ConstString name, Searcher::CallbackReturn BreakpointResolverName::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); if (m_class_name) { if (log) diff --git a/lldb/source/Breakpoint/BreakpointSite.cpp b/lldb/source/Breakpoint/BreakpointSite.cpp index f0469326657c..11ebc59c7e12 100644 --- a/lldb/source/Breakpoint/BreakpointSite.cpp +++ b/lldb/source/Breakpoint/BreakpointSite.cpp @@ -25,9 +25,9 @@ BreakpointSite::BreakpointSite(BreakpointSiteList *list, m_type(eSoftware), // Process subclasses need to set this correctly using // SetType() m_saved_opcode(), m_trap_opcode(), - m_enabled(false), // Need to create it disabled, so the first enable turns - // it on. - m_owners(), m_owners_mutex() { + m_enabled(false) // Need to create it disabled, so the first enable turns + // it on. +{ m_owners.Add(owner); } diff --git a/lldb/source/Breakpoint/BreakpointSiteList.cpp b/lldb/source/Breakpoint/BreakpointSiteList.cpp index c6966145e42b..32a2f24d411a 100644 --- a/lldb/source/Breakpoint/BreakpointSiteList.cpp +++ b/lldb/source/Breakpoint/BreakpointSiteList.cpp @@ -14,7 +14,7 @@ using namespace lldb; using namespace lldb_private; -BreakpointSiteList::BreakpointSiteList() : m_mutex(), m_bp_site_list() {} +BreakpointSiteList::BreakpointSiteList() = default; BreakpointSiteList::~BreakpointSiteList() = default; diff --git a/lldb/source/Breakpoint/StoppointCallbackContext.cpp b/lldb/source/Breakpoint/StoppointCallbackContext.cpp index a561c99b1d92..926c0afe8fc1 100644 --- a/lldb/source/Breakpoint/StoppointCallbackContext.cpp +++ b/lldb/source/Breakpoint/StoppointCallbackContext.cpp @@ -10,7 +10,7 @@ using namespace lldb_private; -StoppointCallbackContext::StoppointCallbackContext() : exe_ctx_ref() {} +StoppointCallbackContext::StoppointCallbackContext() = default; StoppointCallbackContext::StoppointCallbackContext( Event *e, const ExecutionContext &exe_ctx, bool synchronously) diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index 29ae1ef3df26..933661ad7b15 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -17,6 +17,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" @@ -29,8 +30,7 @@ Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size, 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), - m_ignore_count(0), m_false_alarms(0), m_decl_str(), m_watch_spec_str(), - m_type(), m_error(), m_options(), m_being_created(true) { + m_ignore_count(0), m_false_alarms(0), m_being_created(true) { if (type && type->IsValid()) m_type = *type; @@ -40,9 +40,8 @@ Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size, auto type_system_or_err = target.GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS), - std::move(err), "Failed to set type."); + LLDB_LOG_ERROR(GetLog(LLDBLog::Watchpoints), std::move(err), + "Failed to set type."); } else { m_type = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( eEncodingUint, 8 * size); @@ -330,8 +329,7 @@ void Watchpoint::SendWatchpointChangedEvent(WatchpointEventData *data) { Watchpoint::WatchpointEventData::WatchpointEventData( WatchpointEventType sub_type, const WatchpointSP &new_watchpoint_sp) - : EventData(), m_watchpoint_event(sub_type), - m_new_watchpoint_sp(new_watchpoint_sp) {} + : m_watchpoint_event(sub_type), m_new_watchpoint_sp(new_watchpoint_sp) {} Watchpoint::WatchpointEventData::~WatchpointEventData() = default; diff --git a/lldb/source/Breakpoint/WatchpointList.cpp b/lldb/source/Breakpoint/WatchpointList.cpp index 100c1e51ac5a..fc0cc9126d60 100644 --- a/lldb/source/Breakpoint/WatchpointList.cpp +++ b/lldb/source/Breakpoint/WatchpointList.cpp @@ -12,7 +12,7 @@ using namespace lldb; using namespace lldb_private; -WatchpointList::WatchpointList() : m_watchpoints(), m_mutex() {} +WatchpointList::WatchpointList() = default; WatchpointList::~WatchpointList() = default; diff --git a/lldb/source/Breakpoint/WatchpointOptions.cpp b/lldb/source/Breakpoint/WatchpointOptions.cpp index a578e8744efb..c27cd62e0220 100644 --- a/lldb/source/Breakpoint/WatchpointOptions.cpp +++ b/lldb/source/Breakpoint/WatchpointOptions.cpp @@ -27,14 +27,12 @@ bool WatchpointOptions::NullCallback(void *baton, // WatchpointOptions constructor WatchpointOptions::WatchpointOptions() - : m_callback(WatchpointOptions::NullCallback), m_callback_baton_sp(), - m_thread_spec_up() {} + : m_callback(WatchpointOptions::NullCallback) {} // WatchpointOptions copy constructor WatchpointOptions::WatchpointOptions(const WatchpointOptions &rhs) : m_callback(rhs.m_callback), m_callback_baton_sp(rhs.m_callback_baton_sp), - m_callback_is_synchronous(rhs.m_callback_is_synchronous), - m_thread_spec_up() { + m_callback_is_synchronous(rhs.m_callback_is_synchronous) { if (rhs.m_thread_spec_up != nullptr) m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up); } |
