[Lldb-commits] [lldb] 27a762c - [lldb][NFC] Add helper function for computing whether to show Process error (#190189)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Apr 4 10:39:46 PDT 2026
Author: Felipe de Azevedo Piovezan
Date: 2026-04-04T18:39:41+01:00
New Revision: 27a762c1a31726219f00c52ed957f1a48b3cd390
URL: https://github.com/llvm/llvm-project/commit/27a762c1a31726219f00c52ed957f1a48b3cd390
DIFF: https://github.com/llvm/llvm-project/commit/27a762c1a31726219f00c52ed957f1a48b3cd390.diff
LOG: [lldb][NFC] Add helper function for computing whether to show Process error (#190189)
Added:
Modified:
lldb/source/Target/Process.cpp
Removed:
################################################################################
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 34d8b91a42833..506a4c6e4dd8d 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1580,13 +1580,8 @@ Status Process::EnableBreakpointSiteByID(lldb::user_id_t break_id) {
return error;
}
-lldb::break_id_t
-Process::CreateBreakpointSite(const BreakpointLocationSP &constituent,
- bool use_hardware) {
- addr_t load_addr = LLDB_INVALID_ADDRESS;
-
- bool show_error = true;
- switch (GetState()) {
+static bool ShouldShowError(Process &process) {
+ switch (process.GetState()) {
case eStateInvalid:
case eStateUnloaded:
case eStateConnected:
@@ -1594,17 +1589,23 @@ Process::CreateBreakpointSite(const BreakpointLocationSP &constituent,
case eStateLaunching:
case eStateDetached:
case eStateExited:
- show_error = false;
- break;
-
+ return false;
case eStateStopped:
case eStateRunning:
case eStateStepping:
case eStateCrashed:
case eStateSuspended:
- show_error = IsAlive();
- break;
+ return process.IsAlive();
}
+ llvm_unreachable("unhandled process state");
+}
+
+lldb::break_id_t
+Process::CreateBreakpointSite(const BreakpointLocationSP &constituent,
+ bool use_hardware) {
+ addr_t load_addr = LLDB_INVALID_ADDRESS;
+
+ bool show_error = ShouldShowError(*this);
// Reset the IsIndirect flag here, in case the location changes from pointing
// to a indirect symbol to a regular symbol.
More information about the lldb-commits
mailing list