summaryrefslogtreecommitdiff
path: root/lldb/source/API/SBBreakpoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/API/SBBreakpoint.cpp')
-rw-r--r--lldb/source/API/SBBreakpoint.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp
index 8159b851d58cc..eb75bf8b33f43 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -1,4 +1,4 @@
-//===-- SBBreakpoint.cpp ----------------------------------------*- C++ -*-===//
+//===-- SBBreakpoint.cpp --------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -652,19 +652,28 @@ SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) {
bool SBBreakpoint::AddName(const char *new_name) {
LLDB_RECORD_METHOD(bool, SBBreakpoint, AddName, (const char *), new_name);
+ SBError status = AddNameWithErrorHandling(new_name);
+ return status.Success();
+}
+
+SBError SBBreakpoint::AddNameWithErrorHandling(const char *new_name) {
+ LLDB_RECORD_METHOD(SBError, SBBreakpoint, AddNameWithErrorHandling,
+ (const char *), new_name);
+
BreakpointSP bkpt_sp = GetSP();
+ SBError status;
if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
bkpt_sp->GetTarget().GetAPIMutex());
- Status error; // Think I'm just going to swallow the error here, it's
- // probably more annoying to have to provide it.
+ Status error;
bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name, error);
- if (error.Fail())
- return false;
+ status.SetError(error);
+ } else {
+ status.SetErrorString("invalid breakpoint");
}
- return true;
+ return LLDB_RECORD_RESULT(status);
}
void SBBreakpoint::RemoveName(const char *name_to_remove) {
@@ -873,7 +882,7 @@ SBBreakpointList::SBBreakpointList(SBTarget &target)
LLDB_RECORD_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &), target);
}
-SBBreakpointList::~SBBreakpointList() {}
+SBBreakpointList::~SBBreakpointList() = default;
size_t SBBreakpointList::GetSize() const {
LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpointList, GetSize);
@@ -1015,6 +1024,8 @@ void RegisterMethods<SBBreakpoint>(Registry &R) {
LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, SetScriptCallbackBody,
(const char *));
LLDB_REGISTER_METHOD(bool, SBBreakpoint, AddName, (const char *));
+ LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpoint, AddNameWithErrorHandling,
+ (const char *));
LLDB_REGISTER_METHOD(void, SBBreakpoint, RemoveName, (const char *));
LLDB_REGISTER_METHOD(bool, SBBreakpoint, MatchesName, (const char *));
LLDB_REGISTER_METHOD(void, SBBreakpoint, GetNames, (lldb::SBStringList &));