summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite')
-rw-r--r--packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py74
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py1
-rw-r--r--packages/Python/lldbsuite/test/lang/c/register_variables/test.c2
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py4
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile21
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py71
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c4
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c28
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist44
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile28
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h1
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py75
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c22
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c4
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py1
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py2
18 files changed, 395 insertions, 15 deletions
diff --git a/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py b/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py
index bef4be1eb5f89..0b9ad0ed63232 100644
--- a/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py
+++ b/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py
@@ -14,6 +14,7 @@ from lldbsuite.test import lldbutil
class ExprCommandThatRestartsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
def setUp(self):
# Call super's setUp().
@@ -25,6 +26,7 @@ class ExprCommandThatRestartsTestCase(TestBase):
@skipIfFreeBSD # llvm.org/pr19246: intermittent failure
@skipIfDarwin # llvm.org/pr19246: intermittent failure
@skipIfWindows # Test relies on signals, unsupported on Windows
+ @expectedFlakeyAndroid(bugnumber="llvm.org/pr19246")
def test(self):
"""Test calling function that hits a signal and restarts."""
self.build()
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
index 094c867059699..85fa5d380cff2 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
@@ -19,10 +19,11 @@ class NumberOfThreadsTestCase(TestBase):
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break inside main().
- self.line = line_number('main.cpp', '// Set break point at this line.')
+ # Find the line numbers for our break points.
+ self.thread3_notify_all_line = line_number('main.cpp', '// Set thread3 break point on notify_all at this line.')
+ self.thread3_before_lock_line = line_number('main.cpp', '// Set thread3 break point on lock at this line.')
- def test(self):
+ def test_number_of_threads(self):
"""Test number of threads."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
@@ -30,15 +31,15 @@ class NumberOfThreadsTestCase(TestBase):
# This should create a breakpoint with 1 location.
lldbutil.run_break_set_by_file_and_line(
- self, "main.cpp", self.line, num_expected_locations=1)
+ self, "main.cpp", self.thread3_notify_all_line, num_expected_locations=1)
- # The breakpoint list should show 3 locations.
+ # The breakpoint list should show 1 location.
self.expect(
"breakpoint list -f",
"Breakpoint location shown correctly",
substrs=[
"1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
- self.line])
+ self.thread3_notify_all_line])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -57,5 +58,64 @@ class NumberOfThreadsTestCase(TestBase):
# Using std::thread may involve extra threads, so we assert that there are
# at least 4 rather than exactly 4.
self.assertTrue(
- num_threads >= 4,
+ num_threads >= 13,
'Number of expected threads and actual threads do not match.')
+
+ def test_unique_stacks(self):
+ """Test backtrace unique with multiple threads executing the same stack."""
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Set a break point on the thread3 notify all (should get hit on threads 4-13).
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.thread3_before_lock_line, num_expected_locations=1)
+
+ # Run the program.
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # Stopped once.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=["stop reason = breakpoint 1."])
+
+ process = self.process()
+
+ # Get the number of threads
+ num_threads = process.GetNumThreads()
+
+ # Using std::thread may involve extra threads, so we assert that there are
+ # at least 10 thread3's rather than exactly 10.
+ self.assertTrue(
+ num_threads >= 10,
+ 'Number of expected threads and actual threads do not match.')
+
+ # Attempt to walk each of the thread's executing the thread3 function to
+ # the same breakpoint.
+ def is_thread3(thread):
+ for frame in thread:
+ if "thread3" in frame.GetFunctionName(): return True
+ return False
+
+ expect_threads = ""
+ for i in range(num_threads):
+ thread = process.GetThreadAtIndex(i)
+ self.assertTrue(thread.IsValid())
+ if not is_thread3(thread):
+ continue
+
+ # If we aren't stopped out the thread breakpoint try to resume.
+ if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
+ self.runCmd("thread continue %d"%(i+1))
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint)
+
+ expect_threads += " #%d"%(i+1)
+
+ # Construct our expected back trace string
+ expect_string = "10 thread(s)%s" % (expect_threads)
+
+ # Now that we are stopped, we should have 10 threads waiting in the
+ # thread3 function. All of these threads should show as one stack.
+ self.expect("thread backtrace unique",
+ "Backtrace with unique stack shown correctly",
+ substrs=[expect_string,
+ "main.cpp:%d"%self.thread3_before_lock_line])
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp
index 6a0ea4e0d1191..42a07f353030d 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp
@@ -1,15 +1,19 @@
+#include "pseudo_barrier.h"
#include <condition_variable>
#include <mutex>
#include <thread>
+#include <vector>
std::mutex mutex;
std::condition_variable cond;
+pseudo_barrier_t thread3_barrier;
void *
thread3(void *input)
{
- std::unique_lock<std::mutex> lock(mutex);
- cond.notify_all(); // Set break point at this line.
+ pseudo_barrier_wait(thread3_barrier);
+ std::unique_lock<std::mutex> lock(mutex); // Set thread3 break point on lock at this line.
+ cond.notify_all(); // Set thread3 break point on notify_all at this line.
return NULL;
}
@@ -17,7 +21,7 @@ void *
thread2(void *input)
{
std::unique_lock<std::mutex> lock(mutex);
- cond.notify_all();
+ cond.notify_all(); // release main thread
cond.wait(lock);
return NULL;
}
@@ -36,15 +40,23 @@ int main()
std::unique_lock<std::mutex> lock(mutex);
std::thread thread_1(thread1, nullptr);
- cond.wait(lock);
+ cond.wait(lock); // wait for thread2
- std::thread thread_3(thread3, nullptr);
- cond.wait(lock);
+ pseudo_barrier_init(thread3_barrier, 10);
+
+ std::vector<std::thread> thread_3s;
+ for (int i = 0; i < 10; i++) {
+ thread_3s.push_back(std::thread(thread3, nullptr));
+ }
+
+ cond.wait(lock); // wait for thread_3s
lock.unlock();
thread_1.join();
- thread_3.join();
+ for (auto &t : thread_3s){
+ t.join();
+ }
return 0;
}
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
index d54e62887ce1a..c416004625613 100644
--- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
+++ b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
@@ -19,6 +19,7 @@ class NoreturnUnwind(TestBase):
@skipIfWindows # clang-cl does not support gcc style attributes.
# clang does not preserve LR in noreturn functions, making unwinding impossible
@skipIf(compiler="clang", archs=['arm'], oslist=['linux'])
+ @expectedFailureAll(bugnumber="llvm.org/pr33452", triple='^mips')
def test(self):
"""Test that we can backtrace correctly with 'noreturn' functions on the stack"""
self.build()
diff --git a/packages/Python/lldbsuite/test/lang/c/register_variables/test.c b/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
index b95253ef9eea7..f7fb1af132205 100644
--- a/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
+++ b/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-#if defined(__arm__) || defined(__aarch64__)
+#if defined(__arm__) || defined(__aarch64__) || defined (__mips__)
// Clang does not accept regparm attribute on these platforms.
// Fortunately, the default calling convention passes arguments in registers
// anyway.
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py b/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
index 96c5a33f14b03..57f373545380e 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
@@ -121,6 +121,8 @@ class ObjCNewSyntaxTestCase(TestBase):
'7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
+ @expectedFailureAll(
+ bugnumber="rdar://32777981")
def test_update_dictionary(self):
self.runToBreakpoint()
@@ -163,6 +165,8 @@ class ObjCNewSyntaxTestCase(TestBase):
'7.0.0'])
@skipIf(macos_version=["<", "10.12"])
@expectedFailureAll(archs=["i[3-6]86"])
+ @expectedFailureAll(
+ bugnumber="rdar://32777981")
def test_dictionary_literal(self):
self.runToBreakpoint()
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile
new file mode 100644
index 0000000000000..7b321e3deae0a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile
@@ -0,0 +1,21 @@
+CC ?= clang
+
+ifeq "$(ARCH)" ""
+ ARCH = x86_64
+endif
+
+CFLAGS ?= -g -O0 -arch $(ARCH)
+
+all: clean
+ $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd bundle.c
+ mkdir com.apple.sbd.xpc
+ mv com.apple.sbd com.apple.sbd.xpc/
+ mkdir -p com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF
+ mv com.apple.sbd.dSYM/Contents/Resources/DWARF/com.apple.sbd com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF/
+ rm -rf com.apple.sbd.dSYM
+ mkdir hide.app
+ tar cf - com.apple.sbd.xpc com.apple.sbd.xpc.dSYM | ( cd hide.app;tar xBpf -)
+ $(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn main.c
+
+clean:
+ rm -rf a.out a.out.dSYM hide.app com.apple.sbd com.apple.sbd.dSYM com.apple.sbd.xpc com.apple.sbd.xpc.dSYM find-bundle-with-dots-in-fn find-bundle-with-dots-in-fn.dSYM
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
new file mode 100644
index 0000000000000..104e88752ec22
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
@@ -0,0 +1,71 @@
+"""Test that a dSYM can be found when a binary is in a bundle hnd has dots in the filename."""
+
+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 = 'find-bundle-with-dots-in-fn' # must match Makefile
+
+class BundleWithDotInFilenameTestCase(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 bundle 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
+ while i < target.GetNumModules():
+ mod = target.GetModuleAtIndex(i)
+ if mod.GetFileSpec().GetFilename() == 'com.apple.sbd':
+ dsym_name = mod.GetSymbolFileSpec().GetFilename()
+ self.assertTrue (dsym_name == 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded")
+ i=i+1
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c
new file mode 100644
index 0000000000000..c100f9a2c0755
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c
@@ -0,0 +1,4 @@
+int foo ()
+{
+ return 5;
+}
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c
new file mode 100644
index 0000000000000..30761eb1b4091
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c
@@ -0,0 +1,28 @@
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int setup_is_complete = 0;
+
+int main()
+{
+
+ void *handle = dlopen ("com.apple.sbd.xpc/com.apple.sbd", RTLD_NOW);
+ if (handle)
+ {
+ if (dlsym(handle, "foo"))
+ {
+ system ("/bin/rm -rf com.apple.sbd.xpc com.apple.sbd.xpc.dSYM");
+ setup_is_complete = 1;
+
+ // At this point we want lldb to attach to the process. If lldb attaches
+ // before we've removed the dlopen'ed bundle, lldb will find the bundle
+ // at its actual filepath and not have to do any tricky work, invalidating
+ // the test.
+
+ for (int loop_limiter = 0; loop_limiter < 100; loop_limiter++)
+ sleep (1);
+ }
+ }
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist
new file mode 100644
index 0000000000000..82e17116e35e0
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>BuildMachineOSBuild</key>
+ <string>16B2657</string>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>MyFramework</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.test.framework</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>MyFramework</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>113</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleSupportedPlatforms</key>
+ <array>
+ <string>MacOSX</string>
+ </array>
+ <key>CFBundleVersion</key>
+ <string>113</string>
+ <key>DTCompiler</key>
+ <string>com.apple.compilers.llvm.clang.1_0</string>
+ <key>DTPlatformBuild</key>
+ <string>9L120i</string>
+ <key>DTPlatformVersion</key>
+ <string>GM</string>
+ <key>DTSDKBuild</key>
+ <string>17A261x</string>
+ <key>DTSDKName</key>
+ <string>macosx10.13</string>
+ <key>DTXcode</key>
+ <string>0900</string>
+ <key>DTXcodeBuild</key>
+ <string>9L120i</string>
+</dict>
+</plist>
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
new file mode 100644
index 0000000000000..33b09502378c3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
@@ -0,0 +1,28 @@
+CC ?= clang
+
+ifeq "$(ARCH)" ""
+ ARCH = x86_64
+endif
+
+CFLAGS ?= -g -O0 -arch $(ARCH)
+
+all: clean
+ $(CC) $(CFLAGS) -install_name $(PWD)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework myframework.c
+ mkdir -p MyFramework.framework/Versions/A/Headers
+ mkdir -p MyFramework.framework/Versions/A/Resources
+ cp MyFramework MyFramework.framework/Versions/A
+ cp MyFramework.h MyFramework.framework/Versions/A/Headers
+ cp Info.plist MyFramework.framework/Versions/A/Resources
+ ( cd MyFramework.framework/Versions ; ln -s A Current )
+ ( cd MyFramework.framework/ ; ln -s Versions/Current/Headers . )
+ ( cd MyFramework.framework/ ; ln -s Versions/Current/MyFramework . )
+ ( cd MyFramework.framework/ ; ln -s Versions/Current/Resources . )
+ mv MyFramework.dSYM MyFramework.framework.dSYM
+ mkdir hide.app
+ rm -f MyFramework
+ tar cf - MyFramework.framework MyFramework.framework.dSYM | ( cd hide.app;tar xBpf -)
+ $(CC) $(CFLAGS) -o deep-bundle main.c -F. -framework MyFramework
+
+
+clean:
+ rm -rf a.out a.out.dSYM deep-bundle deep-bundle.dSYM MyFramework.framework MyFramework.framework.dSYM MyFramework MyFramework.dSYM hide.app
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h
new file mode 100644
index 0000000000000..a4536647cfc93
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h
@@ -0,0 +1 @@
+int foo ();
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
new file mode 100644
index 0000000000000..493c4b99d094b
--- /dev/null
+++ b/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()
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c
new file mode 100644
index 0000000000000..19715216d6cfc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c
@@ -0,0 +1,22 @@
+#include <MyFramework/MyFramework.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int setup_is_complete = 0;
+
+int main()
+{
+ system ("/bin/rm -rf MyFramework MyFramework.framework MyFramework.framework.dSYM");
+
+ setup_is_complete = 1;
+
+ // At this point we want lldb to attach to the process. If lldb attaches
+ // before we've removed the framework we're running against, it will be
+ // easy for lldb to find the binary & dSYM without using target.exec-search-paths,
+ // which is the point of this test.
+
+ for (int loop_limiter = 0; loop_limiter < 100; loop_limiter++)
+ sleep (1);
+
+ return foo();
+}
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c
new file mode 100644
index 0000000000000..c100f9a2c0755
--- /dev/null
+++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c
@@ -0,0 +1,4 @@
+int foo ()
+{
+ return 5;
+}
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
index f3a18786b03af..bcb632dd4ef84 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
@@ -31,6 +31,7 @@ class TestGdbRemoteSingleStep(gdbremote_testcase.GdbRemoteTestCaseBase):
"arm",
"aarch64"],
bugnumber="llvm.org/pr24739")
+ @skipIf(triple='^mips')
def test_single_step_only_steps_one_instruction_with_s_llgs(self):
self.init_llgs_test()
self.build()
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
index 1d98b9279f4ff..9d0645c5b99df 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
@@ -108,6 +108,7 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
"arm",
"aarch64"],
bugnumber="llvm.org/pr24739")
+ @skipIf(triple='^mips')
def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_llgs(self):
self.init_llgs_test()
self.build()
@@ -136,6 +137,7 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
"arm",
"aarch64"],
bugnumber="llvm.org/pr24739")
+ @skipIf(triple='^mips')
def test_single_step_only_steps_one_instruction_with_vCont_s_thread_llgs(
self):
self.init_llgs_test()