summaryrefslogtreecommitdiff
path: root/source/Breakpoint/BreakpointLocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Breakpoint/BreakpointLocation.cpp')
-rw-r--r--source/Breakpoint/BreakpointLocation.cpp104
1 files changed, 50 insertions, 54 deletions
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(