summaryrefslogtreecommitdiff
path: root/source/Breakpoint
diff options
context:
space:
mode:
Diffstat (limited to 'source/Breakpoint')
-rw-r--r--source/Breakpoint/Breakpoint.cpp47
-rw-r--r--source/Breakpoint/BreakpointID.cpp7
-rw-r--r--source/Breakpoint/BreakpointIDList.cpp9
-rw-r--r--source/Breakpoint/BreakpointList.cpp7
-rw-r--r--source/Breakpoint/BreakpointLocation.cpp104
-rw-r--r--source/Breakpoint/BreakpointLocationCollection.cpp22
-rw-r--r--source/Breakpoint/BreakpointLocationList.cpp9
-rw-r--r--source/Breakpoint/BreakpointName.cpp11
-rw-r--r--source/Breakpoint/BreakpointOptions.cpp99
-rw-r--r--source/Breakpoint/BreakpointPrecondition.cpp26
-rw-r--r--source/Breakpoint/BreakpointResolver.cpp9
-rw-r--r--source/Breakpoint/BreakpointResolverAddress.cpp11
-rw-r--r--source/Breakpoint/BreakpointResolverFileLine.cpp11
-rw-r--r--source/Breakpoint/BreakpointResolverFileRegex.cpp13
-rw-r--r--source/Breakpoint/BreakpointResolverName.cpp43
-rw-r--r--source/Breakpoint/BreakpointResolverScripted.cpp18
-rw-r--r--source/Breakpoint/BreakpointSite.cpp19
-rw-r--r--source/Breakpoint/BreakpointSiteList.cpp11
-rw-r--r--source/Breakpoint/Stoppoint.cpp11
-rw-r--r--source/Breakpoint/StoppointCallbackContext.cpp7
-rw-r--r--source/Breakpoint/StoppointLocation.cpp11
-rw-r--r--source/Breakpoint/Watchpoint.cpp26
-rw-r--r--source/Breakpoint/WatchpointList.cpp7
-rw-r--r--source/Breakpoint/WatchpointOptions.cpp41
24 files changed, 265 insertions, 314 deletions
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp
index 131d2a707d44..3c3841949b91 100644
--- a/source/Breakpoint/Breakpoint.cpp
+++ b/source/Breakpoint/Breakpoint.cpp
@@ -1,9 +1,8 @@
//===-- Breakpoint.cpp ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -12,6 +11,7 @@
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
+#include "lldb/Breakpoint/BreakpointPrecondition.h"
#include "lldb/Breakpoint/BreakpointResolver.h"
#include "lldb/Breakpoint/BreakpointResolverFileLine.h"
#include "lldb/Core/Address.h"
@@ -30,11 +30,13 @@
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
+#include <memory>
+
using namespace lldb;
using namespace lldb_private;
using namespace llvm;
-const ConstString &Breakpoint::GetEventIdentifier() {
+ConstString Breakpoint::GetEventIdentifier() {
static ConstString g_identifier("event-identifier.breakpoint.changed");
return g_identifier;
}
@@ -42,9 +44,7 @@ const ConstString &Breakpoint::GetEventIdentifier() {
const char *Breakpoint::g_option_names[static_cast<uint32_t>(
Breakpoint::OptionNames::LastOptionName)]{"Names", "Hardware"};
-//----------------------------------------------------------------------
// Breakpoint constructor
-//----------------------------------------------------------------------
Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp,
BreakpointResolverSP &resolver_sp, bool hardware,
bool resolve_indirect_symbols)
@@ -58,7 +58,7 @@ Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp,
Breakpoint::Breakpoint(Target &new_target, 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.get())),
+ 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) {
@@ -67,14 +67,10 @@ Breakpoint::Breakpoint(Target &new_target, Breakpoint &source_bp)
m_filter_sp = source_bp.m_filter_sp->CopyForBreakpoint(*this);
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
Breakpoint::~Breakpoint() = default;
-//----------------------------------------------------------------------
// Serialization
-//----------------------------------------------------------------------
StructuredData::ObjectSP Breakpoint::SerializeToStructuredData() {
// Serialize the resolver:
StructuredData::DictionarySP breakpoint_dict_sp(
@@ -159,8 +155,8 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData(
SearchFilter::GetSerializationKey(), filter_dict);
SearchFilterSP filter_sp;
if (!success)
- filter_sp.reset(
- new SearchFilterForUnconstrainedSearches(target.shared_from_this()));
+ filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>(
+ target.shared_from_this());
else {
filter_sp = SearchFilter::CreateFromStructuredData(target, *filter_dict,
create_error);
@@ -495,9 +491,7 @@ void Breakpoint::ClearAllBreakpointSites() {
m_locations.ClearAllBreakpointSites();
}
-//----------------------------------------------------------------------
// ModulesChanged: Pass in a list of new modules, and
-//----------------------------------------------------------------------
void Breakpoint::ModulesChanged(ModuleList &module_list, bool load,
bool delete_locations) {
@@ -971,7 +965,7 @@ void Breakpoint::GetResolverDescription(Stream *s) {
m_resolver_sp->GetDescription(s);
}
-bool Breakpoint::GetMatchingFileLine(const ConstString &filename,
+bool Breakpoint::GetMatchingFileLine(ConstString filename,
uint32_t line_number,
BreakpointLocationCollection &loc_coll) {
// TODO: To be correct, this method needs to fill the breakpoint location
@@ -1002,21 +996,6 @@ bool Breakpoint::EvaluatePrecondition(StoppointCallbackContext &context) {
return m_precondition_sp->EvaluatePrecondition(context);
}
-bool Breakpoint::BreakpointPrecondition::EvaluatePrecondition(
- StoppointCallbackContext &context) {
- return true;
-}
-
-void Breakpoint::BreakpointPrecondition::GetDescription(
- Stream &stream, lldb::DescriptionLevel level) {}
-
-Status
-Breakpoint::BreakpointPrecondition::ConfigurePrecondition(Args &options) {
- Status error;
- error.SetErrorString("Base breakpoint precondition has no options.");
- return error;
-}
-
void Breakpoint::SendBreakpointChangedEvent(
lldb::BreakpointEventType eventKind) {
if (!m_being_created && !IsInternal() &&
@@ -1047,12 +1026,12 @@ Breakpoint::BreakpointEventData::BreakpointEventData(
Breakpoint::BreakpointEventData::~BreakpointEventData() = default;
-const ConstString &Breakpoint::BreakpointEventData::GetFlavorString() {
+ConstString Breakpoint::BreakpointEventData::GetFlavorString() {
static ConstString g_flavor("Breakpoint::BreakpointEventData");
return g_flavor;
}
-const ConstString &Breakpoint::BreakpointEventData::GetFlavor() const {
+ConstString Breakpoint::BreakpointEventData::GetFlavor() const {
return BreakpointEventData::GetFlavorString();
}
diff --git a/source/Breakpoint/BreakpointID.cpp b/source/Breakpoint/BreakpointID.cpp
index eb12e09abcf1..dc2e57cb085d 100644
--- a/source/Breakpoint/BreakpointID.cpp
+++ b/source/Breakpoint/BreakpointID.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointID.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Breakpoint/BreakpointIDList.cpp b/source/Breakpoint/BreakpointIDList.cpp
index b86f276a5c47..1e695fae6995 100644
--- a/source/Breakpoint/BreakpointIDList.cpp
+++ b/source/Breakpoint/BreakpointIDList.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointIDList.cpp ------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,9 +18,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// class BreakpointIDList
-//----------------------------------------------------------------------
BreakpointIDList::BreakpointIDList()
: m_invalid_id(LLDB_INVALID_BREAK_ID, LLDB_INVALID_BREAK_ID) {}
diff --git a/source/Breakpoint/BreakpointList.cpp b/source/Breakpoint/BreakpointList.cpp
index 370da10d82b4..c80fb917b490 100644
--- a/source/Breakpoint/BreakpointList.cpp
+++ b/source/Breakpoint/BreakpointList.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointList.cpp --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp
index 5d3763a367c3..b718e2aeea5c 100644
--- a/source/Breakpoint/BreakpointLocation.cpp
+++ b/source/Breakpoint/BreakpointLocation.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointLocation.cpp ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -36,7 +35,7 @@ BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner,
hardware),
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_ap(), m_bp_site_sp(), m_condition_mutex() {
+ m_owner(owner), m_options_up(), m_bp_site_sp(), m_condition_mutex() {
if (check_for_resolver) {
Symbol *symbol = m_address.CalculateSymbolContextSymbol();
if (symbol && symbol->IsIndirect()) {
@@ -57,10 +56,10 @@ lldb::addr_t BreakpointLocation::GetLoadAddress() const {
const BreakpointOptions *
BreakpointLocation::GetOptionsSpecifyingKind(BreakpointOptions::OptionKind kind)
const {
- if (m_options_ap && m_options_ap->IsOptionSet(kind))
- return m_options_ap.get();
- else
- return m_owner.GetOptions();
+ if (m_options_up && m_options_up->IsOptionSet(kind))
+ return m_options_up.get();
+ else
+ return m_owner.GetOptions();
}
Address &BreakpointLocation::GetAddress() { return m_address; }
@@ -72,8 +71,8 @@ Target &BreakpointLocation::GetTarget() { return m_owner.GetTarget(); }
bool BreakpointLocation::IsEnabled() const {
if (!m_owner.IsEnabled())
return false;
- else if (m_options_ap.get() != nullptr)
- return m_options_ap->IsEnabled();
+ else if (m_options_up != nullptr)
+ return m_options_up->IsEnabled();
else
return true;
}
@@ -90,9 +89,9 @@ void BreakpointLocation::SetEnabled(bool enabled) {
}
bool BreakpointLocation::IsAutoContinue() const {
- if (m_options_ap
- && m_options_ap->IsOptionSet(BreakpointOptions::eAutoContinue))
- return m_options_ap->IsAutoContinue();
+ if (m_options_up &&
+ m_options_up->IsOptionSet(BreakpointOptions::eAutoContinue))
+ return m_options_up->IsAutoContinue();
else
return m_owner.IsAutoContinue();
}
@@ -108,8 +107,8 @@ void BreakpointLocation::SetThreadID(lldb::tid_t thread_id) {
else {
// If we're resetting this to an invalid thread id, then don't make an
// options pointer just to do that.
- if (m_options_ap.get() != nullptr)
- m_options_ap->SetThreadID(thread_id);
+ if (m_options_up != nullptr)
+ m_options_up->SetThreadID(thread_id);
}
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
}
@@ -130,8 +129,8 @@ void BreakpointLocation::SetThreadIndex(uint32_t index) {
else {
// If we're resetting this to an invalid thread id, then don't make an
// options pointer just to do that.
- if (m_options_ap.get() != nullptr)
- m_options_ap->GetThreadSpec()->SetIndex(index);
+ if (m_options_up != nullptr)
+ m_options_up->GetThreadSpec()->SetIndex(index);
}
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
}
@@ -152,8 +151,8 @@ void BreakpointLocation::SetThreadName(const char *thread_name) {
else {
// If we're resetting this to an invalid thread id, then don't make an
// options pointer just to do that.
- if (m_options_ap.get() != nullptr)
- m_options_ap->GetThreadSpec()->SetName(thread_name);
+ if (m_options_up != nullptr)
+ m_options_up->GetThreadSpec()->SetName(thread_name);
}
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
}
@@ -174,8 +173,8 @@ void BreakpointLocation::SetQueueName(const char *queue_name) {
else {
// If we're resetting this to an invalid thread id, then don't make an
// options pointer just to do that.
- if (m_options_ap.get() != nullptr)
- m_options_ap->GetThreadSpec()->SetQueueName(queue_name);
+ if (m_options_up != nullptr)
+ m_options_up->GetThreadSpec()->SetQueueName(queue_name);
}
SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
}
@@ -191,8 +190,8 @@ const char *BreakpointLocation::GetQueueName() const {
}
bool BreakpointLocation::InvokeCallback(StoppointCallbackContext *context) {
- if (m_options_ap.get() != nullptr && m_options_ap->HasCallback())
- return m_options_ap->InvokeCallback(context, m_owner.GetID(), GetID());
+ if (m_options_up != nullptr && m_options_up->HasCallback())
+ return m_options_up->InvokeCallback(context, m_owner.GetID(), GetID());
else
return m_owner.InvokeCallback(context, GetID());
}
@@ -256,7 +255,7 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(
condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
- EvaluateExpressionOptions(), error));
+ EvaluateExpressionOptions(), nullptr, error));
if (error.Fail()) {
if (log)
log->Printf("Error getting condition expression: %s.",
@@ -345,16 +344,16 @@ void BreakpointLocation::SetIgnoreCount(uint32_t n) {
}
void BreakpointLocation::DecrementIgnoreCount() {
- if (m_options_ap.get() != nullptr) {
- uint32_t loc_ignore = m_options_ap->GetIgnoreCount();
+ if (m_options_up != nullptr) {
+ uint32_t loc_ignore = m_options_up->GetIgnoreCount();
if (loc_ignore != 0)
- m_options_ap->SetIgnoreCount(loc_ignore - 1);
+ m_options_up->SetIgnoreCount(loc_ignore - 1);
}
}
bool BreakpointLocation::IgnoreCountShouldStop() {
- if (m_options_ap.get() != nullptr) {
- uint32_t loc_ignore = m_options_ap->GetIgnoreCount();
+ if (m_options_up != nullptr) {
+ uint32_t loc_ignore = m_options_up->GetIgnoreCount();
if (loc_ignore != 0) {
m_owner.DecrementIgnoreCount();
DecrementIgnoreCount(); // Have to decrement our owners' ignore count,
@@ -370,11 +369,10 @@ BreakpointOptions *BreakpointLocation::GetLocationOptions() {
// If we make the copy we don't copy the callbacks because that is
// potentially expensive and we don't want to do that for the simple case
// where someone is just disabling the location.
- if (m_options_ap.get() == nullptr)
- m_options_ap.reset(
- new BreakpointOptions(false));
+ if (m_options_up == nullptr)
+ m_options_up.reset(new BreakpointOptions(false));
- return m_options_ap.get();
+ return m_options_up.get();
}
bool BreakpointLocation::ValidForThisThread(Thread *thread) {
@@ -455,13 +453,11 @@ bool BreakpointLocation::ResolveBreakpointSite() {
if (new_id == LLDB_INVALID_BREAK_ID) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
if (log)
- log->Warning("Tried to add breakpoint site at 0x%" PRIx64
- " but it was already present.\n",
+ log->Warning("Failed to add breakpoint site at 0x%" PRIx64,
m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()));
- return false;
}
- return true;
+ return IsResolved();
}
bool BreakpointLocation::SetBreakpointSite(BreakpointSiteSP &bp_site_sp) {
@@ -606,17 +602,17 @@ void BreakpointLocation::GetDescription(Stream *s,
s->Indent();
s->Printf("hit count = %-4u\n", GetHitCount());
- if (m_options_ap.get()) {
+ if (m_options_up) {
s->Indent();
- m_options_ap->GetDescription(s, level);
+ m_options_up->GetDescription(s, level);
s->EOL();
}
s->IndentLess();
} else if (level != eDescriptionLevelInitial) {
s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
GetHitCount());
- if (m_options_ap.get()) {
- m_options_ap->GetDescription(s, level);
+ if (m_options_up) {
+ m_options_up->GetDescription(s, level);
}
}
}
@@ -627,18 +623,18 @@ void BreakpointLocation::Dump(Stream *s) const {
lldb::tid_t tid = GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
->GetThreadSpecNoCreate()->GetTID();
- s->Printf(
- "BreakpointLocation %u: tid = %4.4" PRIx64 " load addr = 0x%8.8" PRIx64
- " state = %s type = %s breakpoint "
- "hw_index = %i hit_count = %-4u ignore_count = %-4u",
- GetID(), tid,
- (uint64_t)m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()),
- (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled())
- ? "enabled "
- : "disabled",
- IsHardware() ? "hardware" : "software", GetHardwareIndex(), GetHitCount(),
- GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
- ->GetIgnoreCount());
+ s->Printf("BreakpointLocation %u: tid = %4.4" PRIx64
+ " load addr = 0x%8.8" PRIx64 " state = %s type = %s breakpoint "
+ "hw_index = %i hit_count = %-4u ignore_count = %-4u",
+ GetID(), tid,
+ (uint64_t)m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()),
+ (m_options_up ? m_options_up->IsEnabled() : m_owner.IsEnabled())
+ ? "enabled "
+ : "disabled",
+ IsHardware() ? "hardware" : "software", GetHardwareIndex(),
+ GetHitCount(),
+ GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
+ ->GetIgnoreCount());
}
void BreakpointLocation::SendBreakpointLocationChangedEvent(
diff --git a/source/Breakpoint/BreakpointLocationCollection.cpp b/source/Breakpoint/BreakpointLocationCollection.cpp
index 27957a50d2b0..76084adbd2aa 100644
--- a/source/Breakpoint/BreakpointLocationCollection.cpp
+++ b/source/Breakpoint/BreakpointLocationCollection.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointLocationCollection.cpp ------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -17,15 +16,11 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// BreakpointLocationCollection constructor
-//----------------------------------------------------------------------
BreakpointLocationCollection::BreakpointLocationCollection()
: m_break_loc_collection(), m_collection_mutex() {}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
BreakpointLocationCollection::~BreakpointLocationCollection() {}
void BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc) {
@@ -179,3 +174,14 @@ void BreakpointLocationCollection::GetDescription(
(*pos)->GetDescription(s, level);
}
}
+
+BreakpointLocationCollection &BreakpointLocationCollection::operator=(
+ const BreakpointLocationCollection &rhs) {
+ if (this != &rhs) {
+ std::lock(m_collection_mutex, rhs.m_collection_mutex);
+ std::lock_guard<std::mutex> lhs_guard(m_collection_mutex, std::adopt_lock);
+ std::lock_guard<std::mutex> rhs_guard(rhs.m_collection_mutex, std::adopt_lock);
+ m_break_loc_collection = rhs.m_break_loc_collection;
+ }
+ return *this;
+}
diff --git a/source/Breakpoint/BreakpointLocationList.cpp b/source/Breakpoint/BreakpointLocationList.cpp
index 6a3280e961cc..ee586127ee78 100644
--- a/source/Breakpoint/BreakpointLocationList.cpp
+++ b/source/Breakpoint/BreakpointLocationList.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointLocationList.cpp ------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -130,7 +129,7 @@ void BreakpointLocationList::Dump(Stream *s) const {
s->IndentMore();
collection::const_iterator pos, end = m_locations.end();
for (pos = m_locations.begin(); pos != end; ++pos)
- (*pos).get()->Dump(s);
+ (*pos)->Dump(s);
s->IndentLess();
}
diff --git a/source/Breakpoint/BreakpointName.cpp b/source/Breakpoint/BreakpointName.cpp
index baf871ebbae1..749fa86bca9d 100644
--- a/source/Breakpoint/BreakpointName.cpp
+++ b/source/Breakpoint/BreakpointName.cpp
@@ -1,9 +1,8 @@
-//===-- Breakpoint.cpp ------------------------------------------*- C++ -*-===//
+//===-- BreakpointName.cpp --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details->
+// 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
//
//===----------------------------------------------------------------------===//
@@ -29,7 +28,7 @@ const Flags::ValueType BreakpointName::Permissions::permissions_mask
(0x5u)
};
-BreakpointName::BreakpointName(const ConstString &name, const Breakpoint &bkpt,
+BreakpointName::BreakpointName(ConstString name, const Breakpoint &bkpt,
const char *help) :
m_name(name), m_options(bkpt.GetOptions())
{
diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp
index ff497c5633b0..f6f279dc382a 100644
--- a/source/Breakpoint/BreakpointOptions.cpp
+++ b/source/Breakpoint/BreakpointOptions.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointOptions.cpp -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -120,18 +119,16 @@ bool BreakpointOptions::NullCallback(void *baton,
return true;
}
-//----------------------------------------------------------------------
// BreakpointOptions constructor
-//----------------------------------------------------------------------
BreakpointOptions::BreakpointOptions(bool all_flags_set)
: m_callback(BreakpointOptions::NullCallback), m_callback_baton_sp(),
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_ap(),
+ 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) {
- if (all_flags_set)
- m_set_flags.Set(~((Flags::ValueType) 0));
- }
+ if (all_flags_set)
+ m_set_flags.Set(~((Flags::ValueType)0));
+}
BreakpointOptions::BreakpointOptions(const char *condition, bool enabled,
int32_t ignore, bool one_shot,
@@ -148,26 +145,21 @@ BreakpointOptions::BreakpointOptions(const char *condition, bool enabled,
}
}
-//----------------------------------------------------------------------
// BreakpointOptions copy constructor
-//----------------------------------------------------------------------
BreakpointOptions::BreakpointOptions(const BreakpointOptions &rhs)
: m_callback(rhs.m_callback), m_callback_baton_sp(rhs.m_callback_baton_sp),
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_ap(),
- m_auto_continue(rhs.m_auto_continue),
- m_set_flags(rhs.m_set_flags) {
- if (rhs.m_thread_spec_ap.get() != nullptr)
- m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+ 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_condition_text = rhs.m_condition_text;
m_condition_text_hash = rhs.m_condition_text_hash;
}
-//----------------------------------------------------------------------
// BreakpointOptions assignment operator
-//----------------------------------------------------------------------
const BreakpointOptions &BreakpointOptions::
operator=(const BreakpointOptions &rhs) {
m_callback = rhs.m_callback;
@@ -177,8 +169,8 @@ operator=(const BreakpointOptions &rhs) {
m_enabled = rhs.m_enabled;
m_one_shot = rhs.m_one_shot;
m_ignore_count = rhs.m_ignore_count;
- if (rhs.m_thread_spec_ap.get() != nullptr)
- m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+ if (rhs.m_thread_spec_up != nullptr)
+ m_thread_spec_up.reset(new 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;
@@ -229,19 +221,16 @@ void BreakpointOptions::CopyOverSetOptions(const BreakpointOptions &incoming)
m_auto_continue = incoming.m_auto_continue;
m_set_flags.Set(eAutoContinue);
}
- if (incoming.m_set_flags.Test(eThreadSpec) && incoming.m_thread_spec_ap)
- {
- if (!m_thread_spec_ap)
- m_thread_spec_ap.reset(new ThreadSpec(*incoming.m_thread_spec_ap.get()));
+ 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));
else
- *m_thread_spec_ap.get() = *incoming.m_thread_spec_ap.get();
+ *m_thread_spec_up = *incoming.m_thread_spec_up;
m_set_flags.Set(eThreadSpec);
}
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
BreakpointOptions::~BreakpointOptions() = default;
std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
@@ -256,55 +245,50 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
const char *key = GetKey(OptionNames::EnabledState);
bool success;
- if (key) {
+ if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsBoolean(key, enabled);
if (!success) {
- error.SetErrorStringWithFormat("%s key is not a boolean.",
- GetKey(OptionNames::EnabledState));
+ error.SetErrorStringWithFormat("%s key is not a boolean.", key);
return nullptr;
}
set_options.Set(eEnabled);
}
key = GetKey(OptionNames::OneShotState);
- if (key) {
+ if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsBoolean(key, one_shot);
if (!success) {
- error.SetErrorStringWithFormat("%s key is not a boolean.",
- GetKey(OptionNames::OneShotState));
+ error.SetErrorStringWithFormat("%s key is not a boolean.", key);
return nullptr;
}
set_options.Set(eOneShot);
}
key = GetKey(OptionNames::AutoContinue);
- if (key) {
+ if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsBoolean(key, auto_continue);
if (!success) {
- error.SetErrorStringWithFormat("%s key is not a boolean.",
- GetKey(OptionNames::AutoContinue));
+ error.SetErrorStringWithFormat("%s key is not a boolean.", key);
return nullptr;
}
set_options.Set(eAutoContinue);
}
key = GetKey(OptionNames::IgnoreCount);
- if (key) {
+ if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsInteger(key, ignore_count);
if (!success) {
- error.SetErrorStringWithFormat("%s key is not an integer.",
- GetKey(OptionNames::IgnoreCount));
+ error.SetErrorStringWithFormat("%s key is not an integer.", key);
return nullptr;
}
set_options.Set(eIgnoreCount);
}
key = GetKey(OptionNames::ConditionText);
- if (key) {
+ if (key && options_dict.HasKey(key)) {
success = options_dict.GetValueForKeyAsString(key, condition_ref);
if (!success) {
- error.SetErrorStringWithFormat("%s key is not an string.",
- GetKey(OptionNames::ConditionText));
+ error.SetErrorStringWithFormat("%s key is not an string.", key);
return nullptr;
}
set_options.Set(eCondition);
@@ -328,12 +312,11 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
auto bp_options = llvm::make_unique<BreakpointOptions>(
condition_ref.str().c_str(), enabled,
ignore_count, one_shot, auto_continue);
- if (cmd_data_up.get()) {
+ if (cmd_data_up) {
if (cmd_data_up->interpreter == eScriptLanguageNone)
bp_options->SetCommandDataCallback(cmd_data_up);
else {
- ScriptInterpreter *interp =
- target.GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ ScriptInterpreter *interp = target.GetDebugger().GetScriptInterpreter();
if (!interp) {
error.SetErrorStringWithFormat(
"Can't set script commands - no script interpreter");
@@ -405,18 +388,16 @@ StructuredData::ObjectSP BreakpointOptions::SerializeToStructuredData() {
BreakpointOptions::CommandData::GetSerializationKey(), commands_sp);
}
}
- if (m_set_flags.Test(eThreadSpec) && m_thread_spec_ap) {
+ if (m_set_flags.Test(eThreadSpec) && m_thread_spec_up) {
StructuredData::ObjectSP thread_spec_sp =
- m_thread_spec_ap->SerializeToStructuredData();
+ m_thread_spec_up->SerializeToStructuredData();
options_dict_sp->AddItem(ThreadSpec::GetSerializationKey(), thread_spec_sp);
}
return options_dict_sp;
}
-//------------------------------------------------------------------
// Callbacks
-//------------------------------------------------------------------
void BreakpointOptions::SetCallback(BreakpointHitCallback callback,
const lldb::BatonSP &callback_baton_sp,
bool callback_is_synchronous) {
@@ -522,17 +503,16 @@ const char *BreakpointOptions::GetConditionText(size_t *hash) const {
}
const ThreadSpec *BreakpointOptions::GetThreadSpecNoCreate() const {
- return m_thread_spec_ap.get();
+ return m_thread_spec_up.get();
}
ThreadSpec *BreakpointOptions::GetThreadSpec() {
- if (m_thread_spec_ap.get() == nullptr)
- {
+ if (m_thread_spec_up == nullptr) {
m_set_flags.Set(eThreadSpec);
- m_thread_spec_ap.reset(new ThreadSpec());
+ m_thread_spec_up.reset(new ThreadSpec());
}
- return m_thread_spec_ap.get();
+ return m_thread_spec_up.get();
}
void BreakpointOptions::SetThreadID(lldb::tid_t thread_id) {
@@ -542,7 +522,7 @@ void BreakpointOptions::SetThreadID(lldb::tid_t thread_id) {
void BreakpointOptions::SetThreadSpec(
std::unique_ptr<ThreadSpec> &thread_spec_up) {
- m_thread_spec_ap = std::move(thread_spec_up);
+ m_thread_spec_up = std::move(thread_spec_up);
m_set_flags.Set(eThreadSpec);
}
@@ -574,8 +554,8 @@ void BreakpointOptions::GetDescription(Stream *s,
if (m_auto_continue)
s->Printf("auto-continue ");
- if (m_thread_spec_ap.get())
- m_thread_spec_ap->GetDescription(s, level);
+ if (m_thread_spec_up)
+ m_thread_spec_up->GetDescription(s, level);
if (level == lldb::eDescriptionLevelFull) {
s->IndentLess();
@@ -666,6 +646,7 @@ bool BreakpointOptions::BreakpointOptionsCallbackFunction(
options.SetStopOnError(data->stop_on_error);
options.SetEchoCommands(true);
options.SetPrintResults(true);
+ options.SetPrintErrors(true);
options.SetAddToHistory(false);
debugger.GetCommandInterpreter().HandleCommands(commands, &exe_ctx,
@@ -680,7 +661,7 @@ bool BreakpointOptions::BreakpointOptionsCallbackFunction(
void BreakpointOptions::Clear()
{
m_set_flags.Clear();
- m_thread_spec_ap.release();
+ m_thread_spec_up.release();
m_one_shot = false;
m_ignore_count = 0;
m_auto_continue = false;
diff --git a/source/Breakpoint/BreakpointPrecondition.cpp b/source/Breakpoint/BreakpointPrecondition.cpp
new file mode 100644
index 000000000000..a387c75c8356
--- /dev/null
+++ b/source/Breakpoint/BreakpointPrecondition.cpp
@@ -0,0 +1,26 @@
+//===-- BreakpointPrecondition.cpp ------------------------------*- C++ -*-===//
+//
+// 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/BreakpointPrecondition.h"
+#include "lldb/Utility/Status.h"
+
+using namespace lldb_private;
+
+bool BreakpointPrecondition::EvaluatePrecondition(
+ StoppointCallbackContext &context) {
+ return false;
+}
+
+void BreakpointPrecondition::GetDescription(Stream &stream,
+ lldb::DescriptionLevel level) {}
+
+Status BreakpointPrecondition::ConfigurePrecondition(Args &args) {
+ Status error;
+ error.SetErrorString("Base breakpoint precondition has no options.");
+ return error;
+}
diff --git a/source/Breakpoint/BreakpointResolver.cpp b/source/Breakpoint/BreakpointResolver.cpp
index 0a1eeed28954..b3224aa91753 100644
--- a/source/Breakpoint/BreakpointResolver.cpp
+++ b/source/Breakpoint/BreakpointResolver.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointResolver.cpp ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -32,9 +31,7 @@
using namespace lldb_private;
using namespace lldb;
-//----------------------------------------------------------------------
// BreakpointResolver:
-//----------------------------------------------------------------------
const char *BreakpointResolver::g_ty_to_name[] = {"FileAndLine", "Address",
"SymbolName", "SourceRegex",
"Exception", "Unknown"};
diff --git a/source/Breakpoint/BreakpointResolverAddress.cpp b/source/Breakpoint/BreakpointResolverAddress.cpp
index 3084ce41e8e3..8a6fd6a2692c 100644
--- a/source/Breakpoint/BreakpointResolverAddress.cpp
+++ b/source/Breakpoint/BreakpointResolverAddress.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointResolverAddress.cpp ---------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -21,9 +20,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// BreakpointResolverAddress:
-//----------------------------------------------------------------------
BreakpointResolverAddress::BreakpointResolverAddress(
Breakpoint *bkpt, const Address &addr, const FileSpec &module_spec)
: BreakpointResolver(bkpt, BreakpointResolver::AddressResolver),
@@ -127,7 +124,7 @@ Searcher::CallbackReturn
BreakpointResolverAddress::SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) {
- assert(m_breakpoint != NULL);
+ assert(m_breakpoint != nullptr);
if (filter.AddressPasses(m_addr)) {
if (m_breakpoint->GetNumLocations() == 0) {
diff --git a/source/Breakpoint/BreakpointResolverFileLine.cpp b/source/Breakpoint/BreakpointResolverFileLine.cpp
index 438f430bd2a5..a6095be31647 100644
--- a/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointResolverFileLine.cpp --------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,9 +18,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// BreakpointResolverFileLine:
-//----------------------------------------------------------------------
BreakpointResolverFileLine::BreakpointResolverFileLine(
Breakpoint *bkpt, const FileSpec &file_spec, uint32_t line_no,
uint32_t column, lldb::addr_t offset, bool check_inlines,
@@ -207,7 +204,7 @@ BreakpointResolverFileLine::SearchCallback(SearchFilter &filter,
Address *addr, bool containing) {
SymbolContextList sc_list;
- assert(m_breakpoint != NULL);
+ 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
diff --git a/source/Breakpoint/BreakpointResolverFileRegex.cpp b/source/Breakpoint/BreakpointResolverFileRegex.cpp
index 62cf9553c82c..0b2485245b72 100644
--- a/source/Breakpoint/BreakpointResolverFileRegex.cpp
+++ b/source/Breakpoint/BreakpointResolverFileRegex.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointResolverFileRegex.cpp -------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,9 +18,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// BreakpointResolverFileRegex:
-//----------------------------------------------------------------------
BreakpointResolverFileRegex::BreakpointResolverFileRegex(
Breakpoint *bkpt, RegularExpression &regex,
const std::unordered_set<std::string> &func_names, bool exact_match)
@@ -101,7 +98,7 @@ BreakpointResolverFileRegex::SearchCallback(SearchFilter &filter,
SymbolContext &context,
Address *addr, bool containing) {
- assert(m_breakpoint != NULL);
+ assert(m_breakpoint != nullptr);
if (!context.target_sp)
return eCallbackReturnContinue;
@@ -148,7 +145,7 @@ BreakpointResolverFileRegex::SearchCallback(SearchFilter &filter,
BreakpointResolver::SetSCMatchesByLine(filter, sc_list, skip_prologue,
m_regex.GetText());
}
- assert(m_breakpoint != NULL);
+ assert(m_breakpoint != nullptr);
return Searcher::eCallbackReturnContinue;
}
diff --git a/source/Breakpoint/BreakpointResolverName.cpp b/source/Breakpoint/BreakpointResolverName.cpp
index 43f7cb85a574..3ad2e8867f2a 100644
--- a/source/Breakpoint/BreakpointResolverName.cpp
+++ b/source/Breakpoint/BreakpointResolverName.cpp
@@ -1,16 +1,13 @@
//===-- BreakpointResolverName.cpp ------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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/BreakpointResolverName.h"
-#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
-#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Architecture.h"
#include "lldb/Core/Module.h"
@@ -19,6 +16,7 @@
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/Target.h"
+#include "lldb/Target/Language.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
@@ -218,22 +216,29 @@ StructuredData::ObjectSP BreakpointResolverName::SerializeToStructuredData() {
return WrapOptionsDict(options_dict_sp);
}
-void BreakpointResolverName::AddNameLookup(const ConstString &name,
+void BreakpointResolverName::AddNameLookup(ConstString name,
FunctionNameType name_type_mask) {
- ObjCLanguage::MethodName objc_method(name.GetCString(), false);
- if (objc_method.IsValid(false)) {
- std::vector<ConstString> objc_names;
- objc_method.GetFullNames(objc_names, true);
- for (ConstString objc_name : objc_names) {
- Module::LookupInfo lookup;
- lookup.SetName(name);
- lookup.SetLookupName(objc_name);
- lookup.SetNameTypeMask(eFunctionNameTypeFull);
- m_lookups.push_back(lookup);
+
+ Module::LookupInfo lookup(name, name_type_mask, m_language);
+ m_lookups.emplace_back(lookup);
+
+ auto add_variant_funcs = [&](Language *lang) {
+ for (ConstString variant_name : lang->GetMethodNameVariants(name)) {
+ Module::LookupInfo variant_lookup(name, name_type_mask,
+ lang->GetLanguageType());
+ variant_lookup.SetLookupName(variant_name);
+ m_lookups.emplace_back(variant_lookup);
}
+ return true;
+ };
+
+ if (Language *lang = Language::FindPlugin(m_language)) {
+ add_variant_funcs(lang);
} else {
- Module::LookupInfo lookup(name, name_type_mask, m_language);
- m_lookups.push_back(lookup);
+ // Most likely m_language is eLanguageTypeUnknown. We check each language for
+ // possible variants or more qualified names and create lookups for those as
+ // well.
+ Language::ForEach(add_variant_funcs);
}
}
diff --git a/source/Breakpoint/BreakpointResolverScripted.cpp b/source/Breakpoint/BreakpointResolverScripted.cpp
index 47940ef60703..8363795a4d7f 100644
--- a/source/Breakpoint/BreakpointResolverScripted.cpp
+++ b/source/Breakpoint/BreakpointResolverScripted.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointResolverScripted.cpp ---------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -25,9 +24,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// BreakpointResolverScripted:
-//----------------------------------------------------------------------
BreakpointResolverScripted::BreakpointResolverScripted(
Breakpoint *bkpt,
const llvm::StringRef class_name,
@@ -49,7 +46,6 @@ void BreakpointResolverScripted::CreateImplementationIfNeeded() {
if (m_breakpoint) {
TargetSP target_sp = m_breakpoint->GetTargetSP();
ScriptInterpreter *script_interp = target_sp->GetDebugger()
- .GetCommandInterpreter()
.GetScriptInterpreter();
if (!script_interp)
return;
@@ -108,7 +104,6 @@ BreakpointResolverScripted::CreateFromStructuredData(
}
ScriptInterpreter *script_interp = bkpt->GetTarget()
.GetDebugger()
- .GetCommandInterpreter()
.GetScriptInterpreter();
return new BreakpointResolverScripted(bkpt, class_name, depth, args_data_impl,
*script_interp);
@@ -125,15 +120,14 @@ BreakpointResolverScripted::SerializeToStructuredData() {
}
ScriptInterpreter *BreakpointResolverScripted::GetScriptInterpreter() {
- return m_breakpoint->GetTarget().GetDebugger().GetCommandInterpreter()
- .GetScriptInterpreter();
+ return m_breakpoint->GetTarget().GetDebugger().GetScriptInterpreter();
}
Searcher::CallbackReturn
BreakpointResolverScripted::SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) {
- assert(m_breakpoint != NULL);
+ assert(m_breakpoint != nullptr);
bool should_continue = true;
if (!m_implementation_sp)
return Searcher::eCallbackReturnStop;
@@ -150,7 +144,7 @@ BreakpointResolverScripted::SearchCallback(SearchFilter &filter,
lldb::SearchDepth
BreakpointResolverScripted::GetDepth() {
- assert(m_breakpoint != NULL);
+ assert(m_breakpoint != nullptr);
lldb::SearchDepth depth = lldb::eSearchDepthModule;
if (m_implementation_sp) {
ScriptInterpreter *interp = GetScriptInterpreter();
diff --git a/source/Breakpoint/BreakpointSite.cpp b/source/Breakpoint/BreakpointSite.cpp
index 73c1357ce963..a757a01824c7 100644
--- a/source/Breakpoint/BreakpointSite.cpp
+++ b/source/Breakpoint/BreakpointSite.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointSite.cpp --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -49,9 +48,17 @@ break_id_t BreakpointSite::GetNextID() {
// should continue.
bool BreakpointSite::ShouldStop(StoppointCallbackContext *context) {
- std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
IncrementHitCount();
- return m_owners.ShouldStop(context);
+ // 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
+ // the copy.
+ BreakpointLocationCollection owners_copy;
+ {
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+ owners_copy = m_owners;
+ }
+ return owners_copy.ShouldStop(context);
}
bool BreakpointSite::IsBreakpointAtThisSite(lldb::break_id_t bp_id) {
diff --git a/source/Breakpoint/BreakpointSiteList.cpp b/source/Breakpoint/BreakpointSiteList.cpp
index 2fe107ee3e30..7a986fd83983 100644
--- a/source/Breakpoint/BreakpointSiteList.cpp
+++ b/source/Breakpoint/BreakpointSiteList.cpp
@@ -1,9 +1,8 @@
//===-- BreakpointSiteList.cpp ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -86,7 +85,7 @@ public:
BreakpointSiteIDMatches(lldb::break_id_t break_id) : m_break_id(break_id) {}
bool operator()(std::pair<lldb::addr_t, BreakpointSiteSP> val_pair) const {
- return m_break_id == val_pair.second.get()->GetID();
+ return m_break_id == val_pair.second->GetID();
}
private:
@@ -158,7 +157,7 @@ void BreakpointSiteList::Dump(Stream *s) const {
collection::const_iterator pos;
collection::const_iterator end = m_bp_site_list.end();
for (pos = m_bp_site_list.begin(); pos != end; ++pos)
- pos->second.get()->Dump(s);
+ pos->second->Dump(s);
s->IndentLess();
}
diff --git a/source/Breakpoint/Stoppoint.cpp b/source/Breakpoint/Stoppoint.cpp
index 13a8b837469f..4cab975fe320 100644
--- a/source/Breakpoint/Stoppoint.cpp
+++ b/source/Breakpoint/Stoppoint.cpp
@@ -1,9 +1,8 @@
//===-- Stoppoint.cpp -------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -14,14 +13,10 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// Stoppoint constructor
-//----------------------------------------------------------------------
Stoppoint::Stoppoint() : m_bid(LLDB_INVALID_BREAK_ID) {}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
Stoppoint::~Stoppoint() {}
break_id_t Stoppoint::GetID() const { return m_bid; }
diff --git a/source/Breakpoint/StoppointCallbackContext.cpp b/source/Breakpoint/StoppointCallbackContext.cpp
index 828ff18c433f..584bf0060a4a 100644
--- a/source/Breakpoint/StoppointCallbackContext.cpp
+++ b/source/Breakpoint/StoppointCallbackContext.cpp
@@ -1,9 +1,8 @@
//===-- StoppointCallbackContext.cpp ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Breakpoint/StoppointLocation.cpp b/source/Breakpoint/StoppointLocation.cpp
index 73394668508b..8cc6791fa680 100644
--- a/source/Breakpoint/StoppointLocation.cpp
+++ b/source/Breakpoint/StoppointLocation.cpp
@@ -1,9 +1,8 @@
//===-- StoppointLocation.cpp -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -13,9 +12,7 @@
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) {}
@@ -26,9 +23,7 @@ StoppointLocation::StoppointLocation(break_id_t bid, addr_t addr,
m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(byte_size),
m_hit_count(0) {}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
StoppointLocation::~StoppointLocation() {}
void StoppointLocation::DecrementHitCount() {
diff --git a/source/Breakpoint/Watchpoint.cpp b/source/Breakpoint/Watchpoint.cpp
index 34daaee64ccd..e8a926527d24 100644
--- a/source/Breakpoint/Watchpoint.cpp
+++ b/source/Breakpoint/Watchpoint.cpp
@@ -1,9 +1,8 @@
//===-- Watchpoint.cpp ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -273,25 +272,26 @@ bool Watchpoint::InvokeCallback(StoppointCallbackContext *context) {
void Watchpoint::SetCondition(const char *condition) {
if (condition == nullptr || condition[0] == '\0') {
- if (m_condition_ap.get())
- m_condition_ap.reset();
+ if (m_condition_up)
+ m_condition_up.reset();
} else {
// Pass nullptr for expr_prefix (no translation-unit level definitions).
Status error;
- m_condition_ap.reset(m_target.GetUserExpressionForLanguage(
+ m_condition_up.reset(m_target.GetUserExpressionForLanguage(
condition, llvm::StringRef(), lldb::eLanguageTypeUnknown,
- UserExpression::eResultTypeAny, EvaluateExpressionOptions(), error));
+ UserExpression::eResultTypeAny, EvaluateExpressionOptions(), nullptr,
+ error));
if (error.Fail()) {
// FIXME: Log something...
- m_condition_ap.reset();
+ m_condition_up.reset();
}
}
SendWatchpointChangedEvent(eWatchpointEventTypeConditionChanged);
}
const char *Watchpoint::GetConditionText() const {
- if (m_condition_ap.get())
- return m_condition_ap->GetUserText();
+ if (m_condition_up)
+ return m_condition_up->GetUserText();
else
return nullptr;
}
@@ -325,12 +325,12 @@ Watchpoint::WatchpointEventData::WatchpointEventData(
Watchpoint::WatchpointEventData::~WatchpointEventData() = default;
-const ConstString &Watchpoint::WatchpointEventData::GetFlavorString() {
+ConstString Watchpoint::WatchpointEventData::GetFlavorString() {
static ConstString g_flavor("Watchpoint::WatchpointEventData");
return g_flavor;
}
-const ConstString &Watchpoint::WatchpointEventData::GetFlavor() const {
+ConstString Watchpoint::WatchpointEventData::GetFlavor() const {
return WatchpointEventData::GetFlavorString();
}
diff --git a/source/Breakpoint/WatchpointList.cpp b/source/Breakpoint/WatchpointList.cpp
index e1e2864ba0eb..b1c1e6f253eb 100644
--- a/source/Breakpoint/WatchpointList.cpp
+++ b/source/Breakpoint/WatchpointList.cpp
@@ -1,9 +1,8 @@
//===-- WatchpointList.cpp --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Breakpoint/WatchpointOptions.cpp b/source/Breakpoint/WatchpointOptions.cpp
index 033eb66014b9..7dd130a3072c 100644
--- a/source/Breakpoint/WatchpointOptions.cpp
+++ b/source/Breakpoint/WatchpointOptions.cpp
@@ -1,9 +1,8 @@
//===-- WatchpointOptions.cpp -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -26,34 +25,28 @@ bool WatchpointOptions::NullCallback(void *baton,
return true;
}
-//----------------------------------------------------------------------
// WatchpointOptions constructor
-//----------------------------------------------------------------------
WatchpointOptions::WatchpointOptions()
: m_callback(WatchpointOptions::NullCallback), m_callback_baton_sp(),
- m_callback_is_synchronous(false), m_thread_spec_ap() {}
+ m_callback_is_synchronous(false), m_thread_spec_up() {}
-//----------------------------------------------------------------------
// 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_ap() {
- if (rhs.m_thread_spec_ap.get() != nullptr)
- m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+ m_thread_spec_up() {
+ if (rhs.m_thread_spec_up != nullptr)
+ m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
}
-//----------------------------------------------------------------------
// WatchpointOptions assignment operator
-//----------------------------------------------------------------------
const WatchpointOptions &WatchpointOptions::
operator=(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;
- if (rhs.m_thread_spec_ap.get() != nullptr)
- m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+ if (rhs.m_thread_spec_up != nullptr)
+ m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
return *this;
}
@@ -71,14 +64,10 @@ WatchpointOptions::CopyOptionsNoCallback(WatchpointOptions &orig) {
return ret_val;
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
WatchpointOptions::~WatchpointOptions() = default;
-//------------------------------------------------------------------
// Callbacks
-//------------------------------------------------------------------
void WatchpointOptions::SetCallback(WatchpointHitCallback callback,
const BatonSP &callback_baton_sp,
bool callback_is_synchronous) {
@@ -114,14 +103,14 @@ bool WatchpointOptions::HasCallback() {
}
const ThreadSpec *WatchpointOptions::GetThreadSpecNoCreate() const {
- return m_thread_spec_ap.get();
+ return m_thread_spec_up.get();
}
ThreadSpec *WatchpointOptions::GetThreadSpec() {
- if (m_thread_spec_ap.get() == nullptr)
- m_thread_spec_ap.reset(new ThreadSpec());
+ if (m_thread_spec_up == nullptr)
+ m_thread_spec_up.reset(new ThreadSpec());
- return m_thread_spec_ap.get();
+ return m_thread_spec_up.get();
}
void WatchpointOptions::SetThreadID(lldb::tid_t thread_id) {
@@ -153,8 +142,8 @@ void WatchpointOptions::GetDescription(Stream *s,
} else
s->PutCString(" Options: ");
- if (m_thread_spec_ap.get())
- m_thread_spec_ap->GetDescription(s, level);
+ if (m_thread_spec_up)
+ m_thread_spec_up->GetDescription(s, level);
else if (level == eDescriptionLevelBrief)
s->PutCString("thread spec: no ");
if (level == lldb::eDescriptionLevelFull) {