"""
Test process attach when executable was deleted.
"""
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestDeletedExecutable(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipIfWindows
@expectedFailureAll(oslist=["linux"],
triple=no_match('aarch64-.*-android'))
def test(self):
self.build()
exe = self.getBuildArtifact("a.out")
pid_file_path = lldbutil.append_to_process_working_directory(self,
"token_pid_%d" % (int(os.getpid())))
self.addTearDownHook(
lambda: self.run_platform_command(
"rm %s" %
(pid_file_path)))
popen = self.spawnSubprocess(exe, [pid_file_path])
pid = lldbutil.wait_for_file_on_target(self, pid_file_path)
os.remove(exe)
self.runCmd("process attach -p " + str(popen.pid))
self.runCmd("kill")