[Lldb-commits] [lldb] [lldb] Revert stop-on-fork and stop-on-vfork (PR #207663)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 6 00:01:27 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Sergei Druzhkov (DrSergei)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/207663.diff
9 Files Affected:
- (modified) lldb/include/lldb/Target/Process.h (-2)
- (modified) lldb/source/Target/Process.cpp (-12)
- (modified) lldb/source/Target/StopInfo.cpp (+6-8)
- (modified) lldb/source/Target/TargetProperties.td (-8)
- (removed) lldb/test/API/functionalities/fork/stop/Makefile (-3)
- (removed) lldb/test/API/functionalities/fork/stop/TestStopOnForkAndVFork.py (-72)
- (removed) lldb/test/API/functionalities/fork/stop/main.c (-18)
- (removed) lldb/test/Shell/Subprocess/stop-on-fork.test (-11)
- (removed) lldb/test/Shell/Subprocess/stop-on-vfork.test (-11)
``````````diff
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 80b3fa300971f..7b1424e6dfa59 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -108,8 +108,6 @@ class ProcessProperties : public Properties {
bool GetWarningsOptimization() const;
bool GetWarningsUnsupportedLanguage() const;
bool GetStopOnExec() const;
- bool GetStopOnFork() const;
- bool GetStopOnVFork() const;
std::chrono::seconds GetUtilityExpressionTimeout() const;
std::chrono::seconds GetInterruptTimeout() const;
bool GetOSPluginReportsAllThreads() const;
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index d929f45419783..4360250b21475 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -343,18 +343,6 @@ bool ProcessProperties::GetUseDelayedBreakpoints() const {
idx, g_process_properties[idx].default_uint_value != 0);
}
-bool ProcessProperties::GetStopOnFork() const {
- const uint32_t idx = ePropertyStopOnFork;
- return GetPropertyAtIndexAs<bool>(
- idx, g_process_properties[idx].default_uint_value != 0);
-}
-
-bool ProcessProperties::GetStopOnVFork() const {
- const uint32_t idx = ePropertyStopOnVFork;
- return GetPropertyAtIndexAs<bool>(
- idx, g_process_properties[idx].default_uint_value != 0);
-}
-
std::chrono::seconds ProcessProperties::GetUtilityExpressionTimeout() const {
const uint32_t idx = ePropertyUtilityExpressionTimeout;
uint64_t value = GetPropertyAtIndexAs<uint64_t>(
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index 80d7b3b4c2c01..c20b0ed07ee3c 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -1545,8 +1545,8 @@ class StopInfoFork : public StopInfo {
bool ShouldStop(Event *event_ptr) override {
// During expression evaluation, return true so that the fork event
// reaches RunThreadPlan as a real stop (not auto-restarted by
- // DoOnRemoval) or target.process.stop-on-fork is true. RunThreadPlan
- // decides whether to stop or continue based on the stop-on-fork option.
+ // DoOnRemoval). RunThreadPlan decides whether to stop or continue
+ // based on the stop-on-fork option.
//
// We check per-thread (not just process-wide IsRunningExpression)
// because other threads may fork concurrently after the
@@ -1554,9 +1554,8 @@ class StopInfoFork : public StopInfo {
ThreadSP thread_sp(m_thread_wp.lock());
if (thread_sp) {
ProcessSP process_sp = thread_sp->GetProcess();
- if (process_sp && ((process_sp->GetModIDRef().IsRunningExpression() &&
- thread_sp->IsRunningCallFunctionPlan()) ||
- process_sp->GetStopOnFork()))
+ if (process_sp && process_sp->GetModIDRef().IsRunningExpression() &&
+ thread_sp->IsRunningCallFunctionPlan())
return true;
}
return false;
@@ -1611,9 +1610,8 @@ class StopInfoVFork : public StopInfo {
ThreadSP thread_sp(m_thread_wp.lock());
if (thread_sp) {
ProcessSP process_sp = thread_sp->GetProcess();
- if (process_sp && ((process_sp->GetModIDRef().IsRunningExpression() &&
- thread_sp->IsRunningCallFunctionPlan()) ||
- process_sp->GetStopOnVFork()))
+ if (process_sp && process_sp->GetModIDRef().IsRunningExpression() &&
+ thread_sp->IsRunningCallFunctionPlan())
return true;
}
return false;
diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td
index bf016b52afb83..d63bc741e66ed 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -282,14 +282,6 @@ let Definition = "process", Path = "target.process" in {
Global,
DefaultTrue,
Desc<"If true, stop when the inferior exec's.">;
- def StopOnFork: Property<"stop-on-fork", "Boolean">,
- Global,
- DefaultFalse,
- Desc<"If true, stop when the inferior forks. The stop location depends on target.process.follow-fork-mode: 'child' stops in the child process, while 'parent' stops in the original process.">;
- def StopOnVFork: Property<"stop-on-vfork", "Boolean">,
- Global,
- DefaultFalse,
- Desc<"If true, stop when the inferior vforks. The stop location depends on target.process.follow-fork-mode: 'child' stops in the child process, while 'parent' stops in the original process.">;
def UtilityExpressionTimeout: Property<"utility-expression-timeout", "UInt64">,
#ifdef LLDB_SANITIZED
DefaultUnsignedValue<60>,
diff --git a/lldb/test/API/functionalities/fork/stop/Makefile b/lldb/test/API/functionalities/fork/stop/Makefile
deleted file mode 100644
index 10495940055b6..0000000000000
--- a/lldb/test/API/functionalities/fork/stop/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-C_SOURCES := main.c
-
-include Makefile.rules
diff --git a/lldb/test/API/functionalities/fork/stop/TestStopOnForkAndVFork.py b/lldb/test/API/functionalities/fork/stop/TestStopOnForkAndVFork.py
deleted file mode 100644
index 301b143ecc0ba..0000000000000
--- a/lldb/test/API/functionalities/fork/stop/TestStopOnForkAndVFork.py
+++ /dev/null
@@ -1,72 +0,0 @@
-"""
-Make sure that we stop on fork and follow mode works.
-"""
-
-import lldb
-import lldbsuite.test.lldbutil as lldbutil
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test.decorators import *
-
-
- at skipIfRemote
-class TestStopOnForkAndVFork(TestBase):
- NO_DEBUG_INFO_TESTCASE = True
-
- def do_test(self, mode, fork):
- self.build()
-
- args = [fork]
- launch_info = lldb.SBLaunchInfo(args)
- launch_info.SetWorkingDirectory(self.getBuildDir())
-
- (_, process, _, _) = lldbutil.run_to_source_breakpoint(
- self, "// break here", lldb.SBFileSpec("main.c"), launch_info
- )
- self.runCmd(f"settings set target.process.stop-on-{fork} true")
- self.runCmd(f"settings set target.process.follow-fork-mode {mode}")
-
- pid = process.GetProcessID()
-
- process.Continue()
- self.assertState(
- process.GetState(),
- lldb.eStateStopped,
- f"Process should be stopped at {fork}",
- )
- threads = lldbutil.get_stopped_threads(
- process, lldb.eStopReasonVFork if fork == "vfork" else lldb.eStopReasonFork
- )
- self.assertEqual(len(threads), 1, f"We got a thread stopped for {fork}.")
-
- if mode == "parent":
- self.assertEqual(
- self.dbg.GetSelectedTarget().GetProcess().GetProcessID(), pid
- )
- self.expect(
- "continue",
- substrs=[f"exited with status = 0"],
- )
- else: # child
- self.assertNotEqual(
- self.dbg.GetSelectedTarget().GetProcess().GetProcessID(), pid
- )
- self.expect(
- "continue",
- substrs=[f"exited with status = 47"],
- )
-
- @skipIfWindows
- def test_stop_on_fork_and_follow_parent(self):
- self.do_test("parent", "fork")
-
- @skipIfWindows
- def test_stop_on_fork_and_follow_child(self):
- self.do_test("child", "fork")
-
- @skipIfWindows
- def test_stop_on_vfork_and_follow_parent(self):
- self.do_test("parent", "vfork")
-
- @skipIfWindows
- def test_stop_on_vfork_and_follow_child(self):
- self.do_test("child", "vfork")
diff --git a/lldb/test/API/functionalities/fork/stop/main.c b/lldb/test/API/functionalities/fork/stop/main.c
deleted file mode 100644
index 3849e2fc24a6c..0000000000000
--- a/lldb/test/API/functionalities/fork/stop/main.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <assert.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-int main(int argc, char *argv[]) {
- if (argc != 2) {
- _exit(1);
- }
- // break here
- pid_t pid = strcmp(argv[1], "fork") == 0 ? fork() : vfork();
- if (pid == 0) {
- // child
- _exit(47);
- }
- // parent
- _exit(0);
-}
diff --git a/lldb/test/Shell/Subprocess/stop-on-fork.test b/lldb/test/Shell/Subprocess/stop-on-fork.test
deleted file mode 100644
index a83dd613620d7..0000000000000
--- a/lldb/test/Shell/Subprocess/stop-on-fork.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# REQUIRES: native
-# UNSUPPORTED: system-windows
-# RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=fork -o %t
-# RUN: %lldb -b -s %s %t | FileCheck %s
-settings set target.process.stop-on-fork true
-process launch
-# CHECK-NOT: function run in parent
-# CHECK: stop reason = fork
-continue
-# CHECK: function run in parent
-# CHECK: function run in exec'd child
diff --git a/lldb/test/Shell/Subprocess/stop-on-vfork.test b/lldb/test/Shell/Subprocess/stop-on-vfork.test
deleted file mode 100644
index 728858170273a..0000000000000
--- a/lldb/test/Shell/Subprocess/stop-on-vfork.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# REQUIRES: native
-# UNSUPPORTED: system-windows
-# RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t
-# RUN: %lldb -b -s %s %t | FileCheck %s
-settings set target.process.stop-on-vfork true
-process launch
-# CHECK-NOT: function run in parent
-# CHECK: stop reason = vfork
-continue
-# CHECK: function run in parent
-# CHECK: function run in exec'd child
``````````
</details>
https://github.com/llvm/llvm-project/pull/207663
More information about the lldb-commits
mailing list