[Lldb-commits] [lldb] [lldb][NFC] Add helper function for computing whether to show Process error (PR #190189)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 2 08:03:52 PDT 2026
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/190189
The function CreateBreakpointSite does a lot of different things, this commit attempts to simplify it so that future patches can be simpler.
>From 28bd982f843b84f08e316cac37718972b56989d5 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Tue, 31 Mar 2026 15:19:27 +0100
Subject: [PATCH] [lldb][NFC] Add helper function for computing whether to show
Process error
The function CreateBreakpointSite does a lot of different things, this
commit attempts to simplify it so that future patches can be simpler.
---
lldb/source/Target/Process.cpp | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
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