1 """Test that a dSYM can be found when a binary is in a bundle hnd has dots in the filename."""
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 exe_name = 'find-bundle-with-dots-in-fn' # must match Makefile
16 class BundleWithDotInFilenameTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
22 # This test is explicitly a dSYM test, it doesn't need to run for any other config, but
23 # the following doesn't work, fixme.
24 # @skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM")
28 self.source = 'main.c'
31 # Destroy process before TestBase.tearDown()
32 self.dbg.GetSelectedTarget().GetProcess().Destroy()
34 # Call super's tearDown().
35 TestBase.tearDown(self)
37 def test_attach_and_check_dsyms(self):
38 """Test attach to binary, see if the bundle dSYM is found"""
39 exe = self.getBuildArtifact(exe_name)
41 os.chdir(self.getBuildDir());
42 popen = self.spawnSubprocess(exe)
43 self.addTearDownHook(self.cleanupSubprocesses)
45 # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in
48 # Since the library that was dlopen()'ed is now removed, lldb will need to find the
49 # binary & dSYM via target.exec-search-paths
50 settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app"
51 self.runCmd(settings_str)
53 self.runCmd("process attach -p " + str(popen.pid))
55 target = self.dbg.GetSelectedTarget()
56 self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process')
58 setup_complete = target.FindFirstGlobalVariable("setup_is_complete")
59 self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup')
61 # Find the bundle module, see if we found the dSYM too (they're both in "hide.app")
63 while i < target.GetNumModules():
64 mod = target.GetModuleAtIndex(i)
65 if mod.GetFileSpec().GetFilename() == 'com.apple.sbd':
66 dsym_name = mod.GetSymbolFileSpec().GetFilename()
67 self.assertTrue (dsym_name == 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded")
69 os.chdir(self.getSourceDir());
71 if __name__ == '__main__':