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

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 5 16:04:28 PST 2024


================
@@ -0,0 +1,115 @@
+"""
+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()
+
+    def build_run_to_breakpoint(self, use_fork, call_exec):
+        self.build()
+
+        args = []
+        if use_fork:
+            args.append("--fork")
+        if call_exec:
+            args.append("--exec")
+        launch_info = lldb.SBLaunchInfo(args)
+        launch_info.SetWorkingDirectory(self.getBuildDir())
+
+        lldbutil.run_to_source_breakpoint(
+            self, "// break here", lldb.SBFileSpec("main.cpp")
+        )
+
+    def follow_parent_helper(self, use_fork, call_exec):
+        self.build_run_to_breakpoint(use_fork, call_exec)
----------------
clayborg wrote:

```
(target, process, thread, bkpt) = self.build_run_to_breakpoint(use_fork, call_exec)
```

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


More information about the lldb-commits mailing list