[TableGen] Fix validateOperandClass for non Phyical Reg (#118146)
[llvm-project.git] / lldb / test / API / functionalities / deleted-executable / TestDeletedExecutable.py
blob41b309fbb21ee959da511d1f462a98382a74258e
1 """
2 Test process attach when executable was deleted.
3 """
6 import os
7 import lldb
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
17 def test(self):
18 self.build()
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()))
25 self.addTearDownHook(
26 lambda: self.run_platform_command("rm %s" % (pid_file_path))
29 # Spawn a new process
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.
36 os.remove(exe)
38 self.runCmd("process attach -p " + str(popen.pid))
39 self.runCmd("kill")