================ @@ -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() ---------------- clayborg wrote:
We need to add arguments to this to specify if we are calling `vfork` or `fork` and if we are calling exec. We should make a helper function that calls `lldbutil.run_to_source_breakpoint` so it can be used correctly with the right arguemnts getting to the program we launch: ``` def run_to_breakpoint(self, use_fork, call_exec): args = [self.getBuildArtifact("a.out")] 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"), launch_info=launch_info ) ``` Then we can call this function from each of the variations we need: ``` def test_vfork_follow_parent_no_exec(self): def test_vfork_follow_parent_with_exec(self): def test_vfork_follow_child_no_exec(self): def test_vfork_follow_child_with_exec(self): ``` https://github.com/llvm/llvm-project/pull/81564 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits