[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 23 09:57:28 PST 2024


================
@@ -0,0 +1,49 @@
+"""
+Make sure that the concurrent vfork() from multiple threads works correctly.
+"""
+
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+
+class TestConcurrentVFork(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def get_pid_from_variable(self):
+        target = self.dbg.GetTargetAtIndex(0)
+        return target.FindFirstGlobalVariable("g_pid").GetValueAsUnsigned()
+
+    @skipIfWindows
+    def test_vfork_follow_parent(self):
+        """
+        Make sure that debugging concurrent vfork() from multiple threads won't crash lldb during follow-parent.
+        And follow-parent successfully detach all child processes and exit debugger.
+        """
+
+        self.build()
+        lldbutil.run_to_source_breakpoint(
+            self, "// break here", lldb.SBFileSpec("main.cpp")
+        )
----------------
clayborg wrote:

This will become:
```
use_fork = False  # Call `vfork()`
call_exec = False  # Don't call `exec()`
self.run_to_breakpoint(use_fork, call_exec);
```
And all of the other variations will need to set `use_fork` and `call_exec` correctly.

https://github.com/llvm/llvm-project/pull/81564


More information about the lldb-commits mailing list