summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2017-06-15 01:42:48 +0000
committerJason Molenda <jmolenda@apple.com>2017-06-15 01:42:48 +0000
commit244b6bb6cb9e48c9ead988661b5f2416a75f64af (patch)
treed87c38de0a01840f11a6f79fa9b943708c57519d /lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
parentd9201d0a02c4b392c57490d13bb307a5025fcbfa (diff)
downloadbcm5719-llvm-244b6bb6cb9e48c9ead988661b5f2416a75f64af.tar.gz
bcm5719-llvm-244b6bb6cb9e48c9ead988661b5f2416a75f64af.zip
Change how LocateDSYMInVincinityOfExecutable strips off path
components to not depend on "." characters in the fileanme (e.g. "Foundation.framework") but instead to just use path separators. The names of the files themselves may have dots in them ("com.apple.sbd") which would break the old scheme. Also add a test case for this (macosx/find-dsym/bundle-with-dot-in-filename) as well as a test case for r304520 (macosx/find-dsym/deep-bundle) which needed a similar setup to test correctly on a single machine. (both of these are really testing remote debug session situations where the binary can't be found on the system where lldb is running, complicating the test case a bit.) <rdar://problem/31825940> llvm-svn: 305441
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py75
1 files changed, 75 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
new file mode 100644
index 00000000000..493c4b99d09
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
@@ -0,0 +1,75 @@
+"""Test that a dSYM can be found when a binary is in a deep bundle with multiple pathname components."""
+
+from __future__ import print_function
+
+#import unittest2
+import os.path
+from time import sleep
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+exe_name = 'deep-bundle' # must match Makefile
+
+class DeepBundleTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIfRemote
+ @skipUnlessDarwin
+ # This test is explicitly a dSYM test, it doesn't need to run for any other config, but
+ # the following doesn't work, fixme.
+ # @skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM")
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.source = 'main.c'
+
+ def tearDown(self):
+ # Destroy process before TestBase.tearDown()
+ self.dbg.GetSelectedTarget().GetProcess().Destroy()
+
+ # Call super's tearDown().
+ TestBase.tearDown(self)
+
+ def test_attach_and_check_dsyms(self):
+ """Test attach to binary, see if the framework dSYM is found"""
+ exe = os.path.join(os.getcwd(), exe_name)
+ self.build()
+ popen = self.spawnSubprocess(exe)
+ self.addTearDownHook(self.cleanupSubprocesses)
+
+ # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in
+ sleep(5)
+
+ # Since the library that was dlopen()'ed is now removed, lldb will need to find the
+ # binary & dSYM via target.exec-search-paths
+ settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app"
+ self.runCmd(settings_str)
+
+ self.runCmd("process attach -p " + str(popen.pid))
+
+ target = self.dbg.GetSelectedTarget()
+ self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process')
+
+ setup_complete = target.FindFirstGlobalVariable("setup_is_complete")
+ self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup')
+
+ # Find the bundle module, see if we found the dSYM too (they're both in "hide.app")
+ i = 0
+ found_module = False
+ while i < target.GetNumModules():
+ mod = target.GetModuleAtIndex(i)
+ if mod.GetFileSpec().GetFilename() == 'MyFramework':
+ found_module = True
+ dsym_name = mod.GetSymbolFileSpec().GetFilename()
+ self.assertTrue (dsym_name == 'MyFramework', "Check that we found the dSYM for the bundle that was loaded")
+ i=i+1
+
+ self.assertTrue(found_module, "Check that we found the framework loaded in lldb's image list")
+
+if __name__ == '__main__':
+ unittest.main()
OpenPOWER on IntegriCloud