aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectProcess.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2025-07-09 13:19:02 -0700
committerGitHub <noreply@github.com>2025-07-09 13:19:02 -0700
commitd193a586c0b41192b031ce6a858bec0f855560ad (patch)
tree1233d5e36e22f35a3b143cc450140e0ef03e552c /lldb/source/Commands/CommandObjectProcess.cpp
parent0d2b47ae4a01fd97fe479806a45a535ad347eb63 (diff)
downloadllvm-d193a586c0b41192b031ce6a858bec0f855560ad.zip
llvm-d193a586c0b41192b031ce6a858bec0f855560ad.tar.gz
llvm-d193a586c0b41192b031ce6a858bec0f855560ad.tar.bz2
[lldb] Change breakpoint interfaces for error handling (#146972)
This RP changes some Breakpoint-related interfaces to return errors. On its own these improvements are small, but they encourage better error handling going forward. There are a bunch of other candidates, but these were the functions that I touched while working on #146602.
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 0a17442..1181b2d 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -35,6 +35,7 @@
#include "lldb/Utility/Args.h"
#include "lldb/Utility/ScriptedMetadata.h"
#include "lldb/Utility/State.h"
+#include "llvm/Support/FormatAdapters.h"
#include "llvm/ADT/ScopeExit.h"
@@ -642,8 +643,12 @@ protected:
BreakpointLocationSP loc_sp = bp_sp->GetLocationAtIndex(loc_idx);
tmp_id.SetBreakpointLocationID(loc_idx);
if (!with_locs.Contains(tmp_id) && loc_sp->IsEnabled()) {
- locs_disabled.push_back(tmp_id);
- loc_sp->SetEnabled(false);
+ if (llvm::Error error = loc_sp->SetEnabled(false))
+ result.AppendErrorWithFormatv(
+ "failed to disable breakpoint location: {0}",
+ llvm::fmt_consume(std::move(error)));
+ else
+ locs_disabled.push_back(tmp_id);
}
}
}
@@ -698,8 +703,12 @@ protected:
if (bp_sp) {
BreakpointLocationSP loc_sp
= bp_sp->FindLocationByID(bkpt_id.GetLocationID());
- if (loc_sp)
- loc_sp->SetEnabled(true);
+ if (loc_sp) {
+ if (llvm::Error error = loc_sp->SetEnabled(true))
+ result.AppendErrorWithFormatv(
+ "failed to enable breakpoint location: {0}",
+ llvm::fmt_consume(std::move(error)));
+ }
}
}