2 Test process attach when executable was deleted.
8 from lldbsuite
.test
.decorators
import *
9 from lldbsuite
.test
.lldbtest
import *
10 from lldbsuite
.test
import lldbutil
13 class TestDeletedExecutable(TestBase
):
14 NO_DEBUG_INFO_TESTCASE
= True
16 @skipIfWindows # cannot delete a running executable
19 exe
= self
.getBuildArtifact("a.out")
21 # Use a file as a synchronization point between test and inferior.
22 pid_file_path
= lldbutil
.append_to_process_working_directory(
23 self
, "token_pid_%d" % (int(os
.getpid()))
26 lambda: self
.run_platform_command("rm %s" % (pid_file_path
))
30 popen
= self
.spawnSubprocess(exe
, [pid_file_path
])
32 # Wait until process has fully started up.
33 pid
= lldbutil
.wait_for_file_on_target(self
, pid_file_path
)
35 # Now we can safely remove the executable and test if we can attach.
38 self
.runCmd("process attach -p " + str(popen
.pid
))