1"""Test the lldb public C++ api when doing multiple debug sessions simultaneously.""" 2 3import os 4 5import lldb 6from lldbsuite.test.decorators import * 7from lldbsuite.test.lldbtest import * 8from lldbsuite.test import lldbutil 9 10 11class TestMultipleSimultaneousDebuggers(TestBase): 12 13 NO_DEBUG_INFO_TESTCASE = True 14 15 @skipIfNoSBHeaders 16 @skipIfWindows 17 def test_multiple_debuggers(self): 18 env = {self.dylibPath: self.getLLDBLibraryEnvVal(), 19 # We need this in order to run under ASAN, in case only LLDB is ASANified. 20 'ASAN_OPTIONS': os.getenv('ASAN_OPTIONS', None)} 21 22 self.driver_exe = self.getBuildArtifact("multi-process-driver") 23 self.buildDriver('multi-process-driver.cpp', self.driver_exe) 24 self.addTearDownHook(lambda: os.remove(self.driver_exe)) 25 self.signBinary(self.driver_exe) 26 27 self.inferior_exe = self.getBuildArtifact("testprog") 28 self.buildDriver('testprog.cpp', self.inferior_exe) 29 self.addTearDownHook(lambda: os.remove(self.inferior_exe)) 30 31 # check_call will raise a CalledProcessError if multi-process-driver 32 # doesn't return exit code 0 to indicate success. We can let this 33 # exception go - the test harness will recognize it as a test failure. 34 35 if self.TraceOn(): 36 print("Running test %s" % self.driver_exe) 37 check_call([self.driver_exe, self.inferior_exe], env=env) 38 else: 39 with open(os.devnull, 'w') as fnull: 40 check_call([self.driver_exe, self.inferior_exe], 41 env=env, stdout=fnull, stderr=fnull) 42