diff options
Diffstat (limited to 'lldb/source/Breakpoint')
24 files changed, 206 insertions, 198 deletions
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 13acf4bb92e2..317dfa231094 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -1,4 +1,4 @@ -//===-- Breakpoint.cpp ------------------------------------------*- C++ -*-===// +//===-- Breakpoint.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -55,21 +55,29 @@ Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp, m_being_created = false; } -Breakpoint::Breakpoint(Target &new_target, Breakpoint &source_bp) +Breakpoint::Breakpoint(Target &new_target, const Breakpoint &source_bp) : m_being_created(true), m_hardware(source_bp.m_hardware), m_target(new_target), m_name_list(source_bp.m_name_list), 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) { - // Now go through and copy the filter & resolver: - m_resolver_sp = source_bp.m_resolver_sp->CopyForBreakpoint(*this); - m_filter_sp = source_bp.m_filter_sp->CopyForBreakpoint(*this); -} + m_hit_count(0) {} // Destructor Breakpoint::~Breakpoint() = default; +BreakpointSP Breakpoint::CopyFromBreakpoint(TargetSP new_target, + const Breakpoint& bp_to_copy_from) { + if (!new_target) + return BreakpointSP(); + + BreakpointSP bp(new Breakpoint(*new_target, bp_to_copy_from)); + // Now go through and copy the filter & resolver: + bp->m_resolver_sp = bp_to_copy_from.m_resolver_sp->CopyForBreakpoint(bp); + bp->m_filter_sp = bp_to_copy_from.m_filter_sp->CreateCopy(new_target); + return bp; +} + // Serialization StructuredData::ObjectSP Breakpoint::SerializeToStructuredData() { // Serialize the resolver: @@ -120,8 +128,10 @@ StructuredData::ObjectSP Breakpoint::SerializeToStructuredData() { } lldb::BreakpointSP Breakpoint::CreateFromStructuredData( - Target &target, StructuredData::ObjectSP &object_data, Status &error) { + TargetSP target_sp, StructuredData::ObjectSP &object_data, Status &error) { BreakpointSP result_sp; + if (!target_sp) + return result_sp; StructuredData::Dictionary *breakpoint_dict = object_data->GetAsDictionary(); @@ -155,11 +165,11 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( SearchFilter::GetSerializationKey(), filter_dict); SearchFilterSP filter_sp; if (!success) - filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>( - target.shared_from_this()); + filter_sp = + std::make_shared<SearchFilterForUnconstrainedSearches>(target_sp); else { - filter_sp = SearchFilter::CreateFromStructuredData(target, *filter_dict, - create_error); + filter_sp = SearchFilter::CreateFromStructuredData(target_sp, *filter_dict, + create_error); if (create_error.Fail()) { error.SetErrorStringWithFormat( "Error creating breakpoint filter from data: %s.", @@ -170,6 +180,7 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( std::unique_ptr<BreakpointOptions> options_up; StructuredData::Dictionary *options_dict; + Target& target = *target_sp; success = breakpoint_dict->GetValueForKeyAsDictionary( BreakpointOptions::GetSerializationKey(), options_dict); if (success) { @@ -187,8 +198,8 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( success = breakpoint_dict->GetValueForKeyAsBoolean( Breakpoint::GetKey(OptionNames::Hardware), hardware); - result_sp = - target.CreateBreakpoint(filter_sp, resolver_sp, false, hardware, true); + result_sp = target.CreateBreakpoint(filter_sp, resolver_sp, false, + hardware, true); if (result_sp && options_up) { result_sp->m_options_up = std::move(options_up); diff --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp index dc2e57cb085d..293baf4ad1c7 100644 --- a/lldb/source/Breakpoint/BreakpointID.cpp +++ b/lldb/source/Breakpoint/BreakpointID.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointID.cpp ----------------------------------------*- C++ -*-===// +//===-- BreakpointID.cpp --------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -112,7 +112,7 @@ bool BreakpointID::StringIsBreakpointName(llvm::StringRef str, Status &error) { // Cannot contain ., -, or space. if (str.find_first_of(".- ") != llvm::StringRef::npos) { error.SetErrorStringWithFormat("Breakpoint names cannot contain " - "'.' or '-': \"%s\"", + "'.' or '-' or spaces: \"%s\"", str.str().c_str()); return false; } diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index de68c44ec6a4..705bc5ee1c8d 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointIDList.cpp ------------------------------------*- C++ -*-===// +//===-- BreakpointIDList.cpp ----------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -144,7 +144,7 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target, result.SetStatus(eReturnStatusFailed); return; } else - names_found.insert(current_arg); + names_found.insert(std::string(current_arg)); } else if ((i + 2 < old_args.size()) && BreakpointID::IsRangeIdentifier(old_args[i + 1].ref()) && BreakpointID::IsValidIDExpression(current_arg) && diff --git a/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp index 5b23c633d14c..a962703b9518 100644 --- a/lldb/source/Breakpoint/BreakpointList.cpp +++ b/lldb/source/Breakpoint/BreakpointList.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointList.cpp --------------------------------------*- C++ -*-===// +//===-- BreakpointList.cpp ------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 7f08b08c6055..93d54c051ee5 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointLocation.cpp ----------------------------------*- C++ -*-===// +//===-- BreakpointLocation.cpp --------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -369,7 +369,7 @@ BreakpointOptions *BreakpointLocation::GetLocationOptions() { // potentially expensive and we don't want to do that for the simple case // where someone is just disabling the location. if (m_options_up == nullptr) - m_options_up.reset(new BreakpointOptions(false)); + m_options_up = std::make_unique<BreakpointOptions>(false); return m_options_up.get(); } @@ -597,7 +597,8 @@ void BreakpointLocation::GetDescription(Stream *s, s->EOL(); s->Indent(); s->Printf("resolved = %s\n", IsResolved() ? "true" : "false"); - + s->Indent(); + s->Printf("hardware = %s\n", IsHardware() ? "true" : "false"); s->Indent(); s->Printf("hit count = %-4u\n", GetHitCount()); @@ -608,8 +609,8 @@ void BreakpointLocation::GetDescription(Stream *s, } s->IndentLess(); } else if (level != eDescriptionLevelInitial) { - s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"), - GetHitCount()); + s->Printf(", %sresolved, %shit count = %u ", (IsResolved() ? "" : "un"), + (IsHardware() ? "hardware, " : ""), GetHitCount()); if (m_options_up) { m_options_up->GetDescription(s, level); } diff --git a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp index 76084adbd2aa..1eb13cb12ba3 100644 --- a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp +++ b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointLocationCollection.cpp ------------------------*- C++ -*-===// +//===-- BreakpointLocationCollection.cpp ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp b/lldb/source/Breakpoint/BreakpointLocationList.cpp index ee586127ee78..6d271864c445 100644 --- a/lldb/source/Breakpoint/BreakpointLocationList.cpp +++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointLocationList.cpp ------------------------------*- C++ -*-===// +//===-- BreakpointLocationList.cpp ----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/BreakpointName.cpp b/lldb/source/Breakpoint/BreakpointName.cpp index 749fa86bca9d..37903a002363 100644 --- a/lldb/source/Breakpoint/BreakpointName.cpp +++ b/lldb/source/Breakpoint/BreakpointName.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointName.cpp --------------------------------------*- C++ -*-===// +//===-- BreakpointName.cpp ------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index 8fd16f420c04..0ce7b0f852e8 100644 --- a/lldb/source/Breakpoint/BreakpointOptions.cpp +++ b/lldb/source/Breakpoint/BreakpointOptions.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointOptions.cpp -----------------------------------*- C++ -*-===// +//===-- BreakpointOptions.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -154,7 +154,7 @@ BreakpointOptions::BreakpointOptions(const BreakpointOptions &rhs) 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) { if (rhs.m_thread_spec_up != nullptr) - m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up)); + m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up); m_condition_text = rhs.m_condition_text; m_condition_text_hash = rhs.m_condition_text_hash; } @@ -170,7 +170,7 @@ operator=(const BreakpointOptions &rhs) { m_one_shot = rhs.m_one_shot; m_ignore_count = rhs.m_ignore_count; if (rhs.m_thread_spec_up != nullptr) - m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up)); + m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up); m_condition_text = rhs.m_condition_text; m_condition_text_hash = rhs.m_condition_text_hash; m_auto_continue = rhs.m_auto_continue; @@ -223,7 +223,8 @@ void BreakpointOptions::CopyOverSetOptions(const BreakpointOptions &incoming) } if (incoming.m_set_flags.Test(eThreadSpec) && incoming.m_thread_spec_up) { if (!m_thread_spec_up) - m_thread_spec_up.reset(new ThreadSpec(*incoming.m_thread_spec_up)); + m_thread_spec_up = + std::make_unique<ThreadSpec>(*incoming.m_thread_spec_up); else *m_thread_spec_up = *incoming.m_thread_spec_up; m_set_flags.Set(eThreadSpec); @@ -509,7 +510,7 @@ const ThreadSpec *BreakpointOptions::GetThreadSpecNoCreate() const { ThreadSpec *BreakpointOptions::GetThreadSpec() { if (m_thread_spec_up == nullptr) { m_set_flags.Set(eThreadSpec); - m_thread_spec_up.reset(new ThreadSpec()); + m_thread_spec_up = std::make_unique<ThreadSpec>(); } return m_thread_spec_up.get(); @@ -630,11 +631,11 @@ bool BreakpointOptions::BreakpointOptionsCallbackFunction( ExecutionContext exe_ctx(context->exe_ctx_ref); Target *target = exe_ctx.GetTargetPtr(); if (target) { - CommandReturnObject result; Debugger &debugger = target->GetDebugger(); + CommandReturnObject result(debugger.GetUseColor()); + // Rig up the results secondary output stream to the debugger's, so the // output will come out synchronously if the debugger is set up that way. - StreamSP output_stream(debugger.GetAsyncOutputStream()); StreamSP error_stream(debugger.GetAsyncErrorStream()); result.SetImmediateOutputStream(output_stream); diff --git a/lldb/source/Breakpoint/BreakpointPrecondition.cpp b/lldb/source/Breakpoint/BreakpointPrecondition.cpp index a387c75c8356..24a38f0767fe 100644 --- a/lldb/source/Breakpoint/BreakpointPrecondition.cpp +++ b/lldb/source/Breakpoint/BreakpointPrecondition.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointPrecondition.cpp ------------------------------*- C++ -*-===// +//===-- BreakpointPrecondition.cpp ----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp index e0a4e6ac6712..7c03a0745ac6 100644 --- a/lldb/source/Breakpoint/BreakpointResolver.cpp +++ b/lldb/source/Breakpoint/BreakpointResolver.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointResolver.cpp ----------------------------------*- C++ -*-===// +//===-- BreakpointResolver.cpp --------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -60,7 +60,7 @@ BreakpointResolver::NameToResolverTy(llvm::StringRef name) { return UnknownResolver; } -BreakpointResolver::BreakpointResolver(Breakpoint *bkpt, +BreakpointResolver::BreakpointResolver(const BreakpointSP &bkpt, const unsigned char resolverTy, lldb::addr_t offset) : m_breakpoint(bkpt), m_offset(offset), SubclassID(resolverTy) {} @@ -163,7 +163,8 @@ StructuredData::DictionarySP BreakpointResolver::WrapOptionsDict( return type_dict_sp; } -void BreakpointResolver::SetBreakpoint(Breakpoint *bkpt) { +void BreakpointResolver::SetBreakpoint(const BreakpointSP &bkpt) { + assert(bkpt); m_breakpoint = bkpt; NotifyBreakpointSet(); } @@ -327,7 +328,7 @@ void BreakpointResolver::AddLocation(SearchFilter &filter, } BreakpointLocationSP bp_loc_sp(AddLocation(line_start)); - if (log && bp_loc_sp && !m_breakpoint->IsInternal()) { + if (log && bp_loc_sp && !GetBreakpoint()->IsInternal()) { StreamString s; bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); LLDB_LOGF(log, "Added location (skipped prologue: %s): %s \n", @@ -338,7 +339,7 @@ void BreakpointResolver::AddLocation(SearchFilter &filter, BreakpointLocationSP BreakpointResolver::AddLocation(Address loc_addr, bool *new_location) { loc_addr.Slide(m_offset); - return m_breakpoint->AddLocation(loc_addr, new_location); + return GetBreakpoint()->AddLocation(loc_addr, new_location); } void BreakpointResolver::SetOffset(lldb::addr_t offset) { diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp index b98568098b4b..2c56912b56af 100644 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointResolverAddress.cpp ---------------------------*- C++ -*-===// +//===-- BreakpointResolverAddress.cpp -------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -22,21 +22,19 @@ using namespace lldb_private; // BreakpointResolverAddress: BreakpointResolverAddress::BreakpointResolverAddress( - Breakpoint *bkpt, const Address &addr, const FileSpec &module_spec) + const BreakpointSP &bkpt, const Address &addr, const FileSpec &module_spec) : BreakpointResolver(bkpt, BreakpointResolver::AddressResolver), m_addr(addr), m_resolved_addr(LLDB_INVALID_ADDRESS), m_module_filespec(module_spec) {} -BreakpointResolverAddress::BreakpointResolverAddress(Breakpoint *bkpt, +BreakpointResolverAddress::BreakpointResolverAddress(const BreakpointSP &bkpt, const Address &addr) : BreakpointResolver(bkpt, BreakpointResolver::AddressResolver), m_addr(addr), m_resolved_addr(LLDB_INVALID_ADDRESS), m_module_filespec() { } -BreakpointResolverAddress::~BreakpointResolverAddress() {} - BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData( - Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error) { llvm::StringRef module_name; lldb::addr_t addr_offset; @@ -100,7 +98,7 @@ void BreakpointResolverAddress::ResolveBreakpoint(SearchFilter &filter) { bool re_resolve = false; if (m_addr.GetSection() || m_module_filespec) re_resolve = true; - else if (m_breakpoint->GetNumLocations() == 0) + else if (GetBreakpoint()->GetNumLocations() == 0) re_resolve = true; if (re_resolve) @@ -113,7 +111,7 @@ void BreakpointResolverAddress::ResolveBreakpointInModules( bool re_resolve = false; if (m_addr.GetSection()) re_resolve = true; - else if (m_breakpoint->GetNumLocations() == 0) + else if (GetBreakpoint()->GetNumLocations() == 0) re_resolve = true; if (re_resolve) @@ -122,15 +120,16 @@ void BreakpointResolverAddress::ResolveBreakpointInModules( Searcher::CallbackReturn BreakpointResolverAddress::SearchCallback( SearchFilter &filter, SymbolContext &context, Address *addr) { - assert(m_breakpoint != nullptr); + BreakpointSP breakpoint_sp = GetBreakpoint(); + Breakpoint &breakpoint = *breakpoint_sp; if (filter.AddressPasses(m_addr)) { - if (m_breakpoint->GetNumLocations() == 0) { + if (breakpoint.GetNumLocations() == 0) { // If the address is just an offset, and we're given a module, see if we // can find the appropriate module loaded in the binary, and fix up // m_addr to use that. if (!m_addr.IsSectionOffset() && m_module_filespec) { - Target &target = m_breakpoint->GetTarget(); + Target &target = breakpoint.GetTarget(); ModuleSpec module_spec(m_module_filespec); ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec); if (module_sp) { @@ -140,9 +139,9 @@ Searcher::CallbackReturn BreakpointResolverAddress::SearchCallback( } } - m_resolved_addr = m_addr.GetLoadAddress(&m_breakpoint->GetTarget()); + m_resolved_addr = m_addr.GetLoadAddress(&breakpoint.GetTarget()); BreakpointLocationSP bp_loc_sp(AddLocation(m_addr)); - if (bp_loc_sp && !m_breakpoint->IsInternal()) { + if (bp_loc_sp && !breakpoint.IsInternal()) { StreamString s; bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); Log *log( @@ -150,9 +149,9 @@ Searcher::CallbackReturn BreakpointResolverAddress::SearchCallback( LLDB_LOGF(log, "Added location: %s\n", s.GetData()); } } else { - BreakpointLocationSP loc_sp = m_breakpoint->GetLocationAtIndex(0); + BreakpointLocationSP loc_sp = breakpoint.GetLocationAtIndex(0); lldb::addr_t cur_load_location = - m_addr.GetLoadAddress(&m_breakpoint->GetTarget()); + m_addr.GetLoadAddress(&breakpoint.GetTarget()); if (cur_load_location != m_resolved_addr) { m_resolved_addr = cur_load_location; loc_sp->ClearBreakpointSite(); @@ -169,7 +168,7 @@ lldb::SearchDepth BreakpointResolverAddress::GetDepth() { void BreakpointResolverAddress::GetDescription(Stream *s) { s->PutCString("address = "); - m_addr.Dump(s, m_breakpoint->GetTarget().GetProcessSP().get(), + m_addr.Dump(s, GetBreakpoint()->GetTarget().GetProcessSP().get(), Address::DumpStyleModuleWithFileAddress, Address::DumpStyleLoadAddress); } @@ -177,8 +176,8 @@ void BreakpointResolverAddress::GetDescription(Stream *s) { void BreakpointResolverAddress::Dump(Stream *s) const {} lldb::BreakpointResolverSP -BreakpointResolverAddress::CopyForBreakpoint(Breakpoint &breakpoint) { +BreakpointResolverAddress::CopyForBreakpoint(BreakpointSP &breakpoint) { lldb::BreakpointResolverSP ret_sp( - new BreakpointResolverAddress(&breakpoint, m_addr)); + new BreakpointResolverAddress(breakpoint, m_addr)); return ret_sp; } diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 2b26f65816bd..22a4b4ae33ae 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointResolverFileLine.cpp --------------------------*- C++ -*-===// +//===-- BreakpointResolverFileLine.cpp ------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -20,7 +20,7 @@ using namespace lldb_private; // BreakpointResolverFileLine: BreakpointResolverFileLine::BreakpointResolverFileLine( - Breakpoint *bkpt, const FileSpec &file_spec, uint32_t line_no, + const BreakpointSP &bkpt, const FileSpec &file_spec, uint32_t line_no, uint32_t column, lldb::addr_t offset, bool check_inlines, bool skip_prologue, bool exact_match) : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver, offset), @@ -28,10 +28,8 @@ BreakpointResolverFileLine::BreakpointResolverFileLine( m_inlines(check_inlines), m_skip_prologue(skip_prologue), m_exact_match(exact_match) {} -BreakpointResolverFileLine::~BreakpointResolverFileLine() {} - BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( - Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error) { llvm::StringRef filename; uint32_t line_no; @@ -202,8 +200,6 @@ Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback( SearchFilter &filter, SymbolContext &context, Address *addr) { SymbolContextList sc_list; - assert(m_breakpoint != nullptr); - // There is a tricky bit here. You can have two compilation units that // #include the same file, and in one of them the function at m_line_number // is used (and so code and a line entry for it is generated) but in the @@ -263,9 +259,9 @@ void BreakpointResolverFileLine::GetDescription(Stream *s) { void BreakpointResolverFileLine::Dump(Stream *s) const {} lldb::BreakpointResolverSP -BreakpointResolverFileLine::CopyForBreakpoint(Breakpoint &breakpoint) { +BreakpointResolverFileLine::CopyForBreakpoint(BreakpointSP &breakpoint) { lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileLine( - &breakpoint, m_file_spec, m_line_number, m_column, m_offset, m_inlines, + breakpoint, m_file_spec, m_line_number, m_column, GetOffset(), m_inlines, m_skip_prologue, m_exact_match)); return ret_sp; diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp index 6b600a7cf128..62462b2f5441 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointResolverFileRegex.cpp -------------------------*- C++-*-===// +//===-- BreakpointResolverFileRegex.cpp -----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -20,16 +20,14 @@ using namespace lldb_private; // BreakpointResolverFileRegex: BreakpointResolverFileRegex::BreakpointResolverFileRegex( - Breakpoint *bkpt, RegularExpression regex, + const lldb::BreakpointSP &bkpt, RegularExpression regex, const std::unordered_set<std::string> &func_names, bool exact_match) : BreakpointResolver(bkpt, BreakpointResolver::FileRegexResolver), m_regex(std::move(regex)), m_exact_match(exact_match), m_function_names(func_names) {} -BreakpointResolverFileRegex::~BreakpointResolverFileRegex() {} - BreakpointResolver *BreakpointResolverFileRegex::CreateFromStructuredData( - Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + const lldb::BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error) { bool success; @@ -65,7 +63,7 @@ BreakpointResolver *BreakpointResolverFileRegex::CreateFromStructuredData( "BRFR::CFSD: Malformed element %zu in the names array.", i); return nullptr; } - names_set.insert(name); + names_set.insert(std::string(name)); } } @@ -97,7 +95,6 @@ BreakpointResolverFileRegex::SerializeToStructuredData() { Searcher::CallbackReturn BreakpointResolverFileRegex::SearchCallback( SearchFilter &filter, SymbolContext &context, Address *addr) { - assert(m_breakpoint != nullptr); if (!context.target_sp) return eCallbackReturnContinue; @@ -144,7 +141,6 @@ Searcher::CallbackReturn BreakpointResolverFileRegex::SearchCallback( BreakpointResolver::SetSCMatchesByLine(filter, sc_list, skip_prologue, m_regex.GetText()); } - assert(m_breakpoint != nullptr); return Searcher::eCallbackReturnContinue; } @@ -161,9 +157,9 @@ void BreakpointResolverFileRegex::GetDescription(Stream *s) { void BreakpointResolverFileRegex::Dump(Stream *s) const {} lldb::BreakpointResolverSP -BreakpointResolverFileRegex::CopyForBreakpoint(Breakpoint &breakpoint) { +BreakpointResolverFileRegex::CopyForBreakpoint(BreakpointSP &breakpoint) { lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex( - &breakpoint, m_regex, m_function_names, m_exact_match)); + breakpoint, m_regex, m_function_names, m_exact_match)); return ret_sp; } diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index ba9c88c7eae8..25f5bb3f6eed 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointResolverName.cpp ------------------------------*- C++ -*-===// +//===-- BreakpointResolverName.cpp ----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -23,8 +23,8 @@ using namespace lldb; using namespace lldb_private; -BreakpointResolverName::BreakpointResolverName( - Breakpoint *bkpt, const char *name_cstr, FunctionNameType name_type_mask, +BreakpointResolverName::BreakpointResolverName(const BreakpointSP &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), @@ -45,7 +45,7 @@ BreakpointResolverName::BreakpointResolverName( } BreakpointResolverName::BreakpointResolverName( - Breakpoint *bkpt, const char *names[], size_t num_names, + const BreakpointSP &bkpt, const char *names[], size_t num_names, FunctionNameType name_type_mask, LanguageType language, lldb::addr_t offset, bool skip_prologue) : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset), @@ -56,7 +56,7 @@ BreakpointResolverName::BreakpointResolverName( } } -BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt, +BreakpointResolverName::BreakpointResolverName(const BreakpointSP &bkpt, std::vector<std::string> names, FunctionNameType name_type_mask, LanguageType language, @@ -70,7 +70,7 @@ BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt, } } -BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt, +BreakpointResolverName::BreakpointResolverName(const BreakpointSP &bkpt, RegularExpression func_regex, lldb::LanguageType language, lldb::addr_t offset, @@ -80,18 +80,16 @@ BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt, m_match_type(Breakpoint::Regexp), m_language(language), m_skip_prologue(skip_prologue) {} -BreakpointResolverName::~BreakpointResolverName() = default; - BreakpointResolverName::BreakpointResolverName( const BreakpointResolverName &rhs) - : BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver, - rhs.m_offset), + : BreakpointResolver(rhs.GetBreakpoint(), BreakpointResolver::NameResolver, + rhs.GetOffset()), m_lookups(rhs.m_lookups), m_class_name(rhs.m_class_name), m_regex(rhs.m_regex), m_match_type(rhs.m_match_type), m_language(rhs.m_language), m_skip_prologue(rhs.m_skip_prologue) {} BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( - Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error) { LanguageType language = eLanguageTypeUnknown; llvm::StringRef language_name; @@ -173,7 +171,7 @@ BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( error.SetErrorString("BRN::CFSD: name mask entry is not an integer."); return nullptr; } - names.push_back(name); + names.push_back(std::string(name)); name_masks.push_back(static_cast<FunctionNameType>(fnt)); } @@ -199,7 +197,7 @@ StructuredData::ObjectSP BreakpointResolverName::SerializeToStructuredData() { StructuredData::ArraySP name_masks_sp(new StructuredData::Array()); for (auto lookup : m_lookups) { names_sp->AddItem(StructuredData::StringSP( - new StructuredData::String(lookup.GetName().AsCString()))); + new StructuredData::String(lookup.GetName().GetStringRef()))); name_masks_sp->AddItem(StructuredData::IntegerSP( new StructuredData::Integer(lookup.GetNameTypeMask()))); } @@ -251,14 +249,6 @@ void BreakpointResolverName::AddNameLookup(ConstString name, Searcher::CallbackReturn BreakpointResolverName::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) { - SymbolContextList func_list; - // SymbolContextList sym_list; - - uint32_t i; - bool new_location; - Address break_addr; - assert(m_breakpoint != nullptr); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (m_class_name) { @@ -266,6 +256,8 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter, log->Warning("Class/method function specification not supported yet.\n"); return Searcher::eCallbackReturnStop; } + + SymbolContextList func_list; bool filter_by_cu = (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0; bool filter_by_language = (m_language != eLanguageTypeUnknown); @@ -278,8 +270,9 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter, for (const auto &lookup : m_lookups) { const size_t start_func_idx = func_list.GetSize(); context.module_sp->FindFunctions( - lookup.GetLookupName(), nullptr, lookup.GetNameTypeMask(), - include_symbols, include_inlines, func_list); + lookup.GetLookupName(), CompilerDeclContext(), + lookup.GetNameTypeMask(), include_symbols, include_inlines, + func_list); const size_t end_func_idx = func_list.GetSize(); @@ -333,66 +326,72 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter, } } + BreakpointSP breakpoint_sp = GetBreakpoint(); + Breakpoint &breakpoint = *breakpoint_sp; + Address break_addr; + // Remove any duplicates between the function list and the symbol list SymbolContext sc; - if (func_list.GetSize()) { - for (i = 0; i < func_list.GetSize(); i++) { - if (func_list.GetContextAtIndex(i, sc)) { - bool is_reexported = false; - - if (sc.block && sc.block->GetInlinedFunctionInfo()) { - if (!sc.block->GetStartAddress(break_addr)) - break_addr.Clear(); - } else if (sc.function) { - break_addr = sc.function->GetAddressRange().GetBaseAddress(); - if (m_skip_prologue && break_addr.IsValid()) { - const uint32_t prologue_byte_size = - sc.function->GetPrologueByteSize(); - if (prologue_byte_size) - break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size); - } - } else if (sc.symbol) { - if (sc.symbol->GetType() == eSymbolTypeReExported) { - const Symbol *actual_symbol = - sc.symbol->ResolveReExportedSymbol(m_breakpoint->GetTarget()); - if (actual_symbol) { - is_reexported = true; - break_addr = actual_symbol->GetAddress(); - } - } else { - break_addr = sc.symbol->GetAddress(); - } - - if (m_skip_prologue && break_addr.IsValid()) { - const uint32_t prologue_byte_size = - sc.symbol->GetPrologueByteSize(); - if (prologue_byte_size) - break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size); - else { - const Architecture *arch = - m_breakpoint->GetTarget().GetArchitecturePlugin(); - if (arch) - arch->AdjustBreakpointAddress(*sc.symbol, break_addr); - } - } + if (!func_list.GetSize()) + return Searcher::eCallbackReturnContinue; + + for (uint32_t i = 0; i < func_list.GetSize(); i++) { + if (!func_list.GetContextAtIndex(i, sc)) + continue; + + bool is_reexported = false; + + if (sc.block && sc.block->GetInlinedFunctionInfo()) { + if (!sc.block->GetStartAddress(break_addr)) + break_addr.Clear(); + } else if (sc.function) { + break_addr = sc.function->GetAddressRange().GetBaseAddress(); + if (m_skip_prologue && break_addr.IsValid()) { + const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize(); + if (prologue_byte_size) + break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size); + } + } else if (sc.symbol) { + if (sc.symbol->GetType() == eSymbolTypeReExported) { + const Symbol *actual_symbol = + sc.symbol->ResolveReExportedSymbol(breakpoint.GetTarget()); + if (actual_symbol) { + is_reexported = true; + break_addr = actual_symbol->GetAddress(); } + } else { + break_addr = sc.symbol->GetAddress(); + } - if (break_addr.IsValid()) { - if (filter.AddressPasses(break_addr)) { - BreakpointLocationSP bp_loc_sp( - AddLocation(break_addr, &new_location)); - bp_loc_sp->SetIsReExported(is_reexported); - if (bp_loc_sp && new_location && !m_breakpoint->IsInternal()) { - if (log) { - StreamString s; - bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); - LLDB_LOGF(log, "Added location: %s\n", s.GetData()); - } - } - } + if (m_skip_prologue && break_addr.IsValid()) { + const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize(); + if (prologue_byte_size) + break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size); + else { + const Architecture *arch = + breakpoint.GetTarget().GetArchitecturePlugin(); + if (arch) + arch->AdjustBreakpointAddress(*sc.symbol, break_addr); } } } + + if (!break_addr.IsValid()) + continue; + + if (!filter.AddressPasses(break_addr)) + continue; + + bool new_location; + BreakpointLocationSP bp_loc_sp(AddLocation(break_addr, &new_location)); + bp_loc_sp->SetIsReExported(is_reexported); + if (bp_loc_sp && new_location && !breakpoint.IsInternal()) { + if (log) { + StreamString s; + bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); + LLDB_LOGF(log, "Added location: %s\n", s.GetData()); + } + } } return Searcher::eCallbackReturnContinue; @@ -426,8 +425,8 @@ void BreakpointResolverName::GetDescription(Stream *s) { void BreakpointResolverName::Dump(Stream *s) const {} lldb::BreakpointResolverSP -BreakpointResolverName::CopyForBreakpoint(Breakpoint &breakpoint) { +BreakpointResolverName::CopyForBreakpoint(BreakpointSP &breakpoint) { lldb::BreakpointResolverSP ret_sp(new BreakpointResolverName(*this)); - ret_sp->SetBreakpoint(&breakpoint); + ret_sp->SetBreakpoint(breakpoint); return ret_sp; } diff --git a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp index 288fd37c1c79..92297fbc7c4b 100644 --- a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointResolverScripted.cpp ---------------------------*- C++ -*-===// +//===-- BreakpointResolverScripted.cpp ------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -26,43 +26,42 @@ using namespace lldb_private; // BreakpointResolverScripted: BreakpointResolverScripted::BreakpointResolverScripted( - Breakpoint *bkpt, - const llvm::StringRef class_name, - lldb::SearchDepth depth, - StructuredDataImpl *args_data) + const BreakpointSP &bkpt, const llvm::StringRef class_name, + lldb::SearchDepth depth, StructuredDataImpl *args_data) : BreakpointResolver(bkpt, BreakpointResolver::PythonResolver), - m_class_name(class_name), m_depth(depth), m_args_ptr(args_data) { - CreateImplementationIfNeeded(); + m_class_name(std::string(class_name)), m_depth(depth), + m_args_ptr(args_data) { + CreateImplementationIfNeeded(bkpt); } -void BreakpointResolverScripted::CreateImplementationIfNeeded() { +void BreakpointResolverScripted::CreateImplementationIfNeeded( + BreakpointSP breakpoint_sp) { 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() - .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); - } + + if (!breakpoint_sp) + return; + + TargetSP target_sp = breakpoint_sp->GetTargetSP(); + ScriptInterpreter *script_interp = target_sp->GetDebugger() + .GetScriptInterpreter(); + if (!script_interp) + return; + + m_implementation_sp = script_interp->CreateScriptedBreakpointResolver( + m_class_name.c_str(), m_args_ptr, breakpoint_sp); } void BreakpointResolverScripted::NotifyBreakpointSet() { - CreateImplementationIfNeeded(); + CreateImplementationIfNeeded(GetBreakpoint()); } -BreakpointResolverScripted::~BreakpointResolverScripted() {} - BreakpointResolver * BreakpointResolverScripted::CreateFromStructuredData( - Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error) { llvm::StringRef class_name; bool success; @@ -103,29 +102,27 @@ BreakpointResolverScripted::SerializeToStructuredData() { } ScriptInterpreter *BreakpointResolverScripted::GetScriptInterpreter() { - return m_breakpoint->GetTarget().GetDebugger().GetScriptInterpreter(); + return GetBreakpoint()->GetTarget().GetDebugger().GetScriptInterpreter(); } Searcher::CallbackReturn BreakpointResolverScripted::SearchCallback( SearchFilter &filter, SymbolContext &context, Address *addr) { - assert(m_breakpoint != nullptr); 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; + + return Searcher::eCallbackReturnStop; } lldb::SearchDepth BreakpointResolverScripted::GetDepth() { - assert(m_breakpoint != nullptr); lldb::SearchDepth depth = lldb::eSearchDepthModule; if (m_implementation_sp) { ScriptInterpreter *interp = GetScriptInterpreter(); @@ -153,11 +150,11 @@ void BreakpointResolverScripted::GetDescription(Stream *s) { void BreakpointResolverScripted::Dump(Stream *s) const {} lldb::BreakpointResolverSP -BreakpointResolverScripted::CopyForBreakpoint(Breakpoint &breakpoint) { +BreakpointResolverScripted::CopyForBreakpoint(BreakpointSP &breakpoint) { // 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, + new BreakpointResolverScripted(breakpoint, m_class_name, m_depth, nullptr)); return ret_sp; } diff --git a/lldb/source/Breakpoint/BreakpointSite.cpp b/lldb/source/Breakpoint/BreakpointSite.cpp index a757a01824c7..a33fd0a1c462 100644 --- a/lldb/source/Breakpoint/BreakpointSite.cpp +++ b/lldb/source/Breakpoint/BreakpointSite.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointSite.cpp --------------------------------------*- C++ -*-===// +//===-- BreakpointSite.cpp ------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -156,6 +156,13 @@ 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, diff --git a/lldb/source/Breakpoint/BreakpointSiteList.cpp b/lldb/source/Breakpoint/BreakpointSiteList.cpp index 7a986fd83983..873ba6236a72 100644 --- a/lldb/source/Breakpoint/BreakpointSiteList.cpp +++ b/lldb/source/Breakpoint/BreakpointSiteList.cpp @@ -1,4 +1,4 @@ -//===-- BreakpointSiteList.cpp ----------------------------------*- C++ -*-===// +//===-- BreakpointSiteList.cpp --------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/Stoppoint.cpp b/lldb/source/Breakpoint/Stoppoint.cpp index 4cab975fe320..b5c8334333cf 100644 --- a/lldb/source/Breakpoint/Stoppoint.cpp +++ b/lldb/source/Breakpoint/Stoppoint.cpp @@ -1,4 +1,4 @@ -//===-- Stoppoint.cpp -------------------------------------------*- C++ -*-===// +//===-- Stoppoint.cpp -----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/StoppointCallbackContext.cpp b/lldb/source/Breakpoint/StoppointCallbackContext.cpp index 584bf0060a4a..640db8bb9c96 100644 --- a/lldb/source/Breakpoint/StoppointCallbackContext.cpp +++ b/lldb/source/Breakpoint/StoppointCallbackContext.cpp @@ -1,4 +1,4 @@ -//===-- StoppointCallbackContext.cpp ----------------------------*- C++ -*-===// +//===-- StoppointCallbackContext.cpp --------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/StoppointLocation.cpp b/lldb/source/Breakpoint/StoppointLocation.cpp index 8cc6791fa680..5bb4c7854840 100644 --- a/lldb/source/Breakpoint/StoppointLocation.cpp +++ b/lldb/source/Breakpoint/StoppointLocation.cpp @@ -1,4 +1,4 @@ -//===-- StoppointLocation.cpp -----------------------------------*- C++ -*-===// +//===-- 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. diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index 17dcda13e9b9..df73c6a17230 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -1,4 +1,4 @@ -//===-- Watchpoint.cpp ------------------------------------------*- C++ -*-===// +//===-- Watchpoint.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/WatchpointList.cpp b/lldb/source/Breakpoint/WatchpointList.cpp index b1c1e6f253eb..a6f651e84955 100644 --- a/lldb/source/Breakpoint/WatchpointList.cpp +++ b/lldb/source/Breakpoint/WatchpointList.cpp @@ -1,4 +1,4 @@ -//===-- WatchpointList.cpp --------------------------------------*- C++ -*-===// +//===-- WatchpointList.cpp ------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Breakpoint/WatchpointOptions.cpp b/lldb/source/Breakpoint/WatchpointOptions.cpp index 026bf2f746ae..f01f5ad3dd27 100644 --- a/lldb/source/Breakpoint/WatchpointOptions.cpp +++ b/lldb/source/Breakpoint/WatchpointOptions.cpp @@ -1,4 +1,4 @@ -//===-- WatchpointOptions.cpp -----------------------------------*- C++ -*-===// +//===-- WatchpointOptions.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -36,7 +36,7 @@ WatchpointOptions::WatchpointOptions(const WatchpointOptions &rhs) m_callback_is_synchronous(rhs.m_callback_is_synchronous), m_thread_spec_up() { if (rhs.m_thread_spec_up != nullptr) - m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up)); + m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up); } // WatchpointOptions assignment operator @@ -46,7 +46,7 @@ operator=(const WatchpointOptions &rhs) { m_callback_baton_sp = rhs.m_callback_baton_sp; m_callback_is_synchronous = rhs.m_callback_is_synchronous; if (rhs.m_thread_spec_up != nullptr) - m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up)); + m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up); return *this; } @@ -108,7 +108,7 @@ const ThreadSpec *WatchpointOptions::GetThreadSpecNoCreate() const { ThreadSpec *WatchpointOptions::GetThreadSpec() { if (m_thread_spec_up == nullptr) - m_thread_spec_up.reset(new ThreadSpec()); + m_thread_spec_up = std::make_unique<ThreadSpec>(); return m_thread_spec_up.get(); } |