summaryrefslogtreecommitdiffstats
path: root/lldb/test/macosx
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-08-15 02:49:16 +0000
committerJason Molenda <jmolenda@apple.com>2013-08-15 02:49:16 +0000
commit680a7d770353e82f2bdeff18b16cfcc7bdb44d8e (patch)
treedc37bc5b06d8d96e4080043dee0228afc6dd5ec7 /lldb/test/macosx
parentd9c2783d8f7b7a27514d2d31083420422361df5b (diff)
downloadbcm5719-llvm-680a7d770353e82f2bdeff18b16cfcc7bdb44d8e.tar.gz
bcm5719-llvm-680a7d770353e82f2bdeff18b16cfcc7bdb44d8e.zip
A new test case which adds a dSYM to an executable mid-debug session
where the executable has been slid. This detects the regression fixed in r188289. llvm-svn: 188443
Diffstat (limited to 'lldb/test/macosx')
-rw-r--r--lldb/test/macosx/add-dsym/Makefile11
-rw-r--r--lldb/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py47
-rw-r--r--lldb/test/macosx/add-dsym/main.c7
3 files changed, 65 insertions, 0 deletions
diff --git a/lldb/test/macosx/add-dsym/Makefile b/lldb/test/macosx/add-dsym/Makefile
new file mode 100644
index 00000000000..4e4aa71de2a
--- /dev/null
+++ b/lldb/test/macosx/add-dsym/Makefile
@@ -0,0 +1,11 @@
+CC ?= clang
+
+all: clean
+ mkdir hide.app
+ mkdir hide.app/Contents
+ $(CC) -g main.c
+ mv a.out.dSYM hide.app/Contents
+ strip -x a.out
+
+clean:
+ rm -rf a.out a.out.dSYM hide.app
diff --git a/lldb/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py b/lldb/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
new file mode 100644
index 00000000000..ce84b2fe87a
--- /dev/null
+++ b/lldb/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
@@ -0,0 +1,47 @@
+"""Test that the 'add-dsym', aka 'target symbols add', succeeds in the middle of debug session."""
+
+import os, time
+import unittest2
+import lldb
+import pexpect
+from lldbtest import *
+
+@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+class AddDsymMidExecutionCommandCase(TestBase):
+
+ mydir = os.path.join ("macosx", "add-dsym")
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ self.source = 'main.c'
+
+ def test_add_dsym_mid_execution(self):
+ """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
+ self.buildDsym(clean=True)
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+
+ main_bp = self.target.BreakpointCreateByName ("main", "a.out")
+ self.assertTrue(main_bp, VALID_BREAKPOINT)
+
+ self.runCmd("settings set target.disable-aslr false")
+ self.process = self.target.LaunchSimple(None, None, os.getcwd())
+ self.assertTrue(self.process, PROCESS_IS_VALID)
+
+ # The stop reason of the thread should be breakpoint.
+ self.assertTrue(self.process.GetState() == lldb.eStateStopped,
+ STOPPED_DUE_TO_BREAKPOINT)
+
+ self.runCmd("add-dsym hide.app/Contents/a.out.dSYM")
+
+ self.expect("frame select",
+ substrs = ['a.out`main at main.c'])
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
diff --git a/lldb/test/macosx/add-dsym/main.c b/lldb/test/macosx/add-dsym/main.c
new file mode 100644
index 00000000000..da9e09f0738
--- /dev/null
+++ b/lldb/test/macosx/add-dsym/main.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+static int var = 5;
+int main ()
+{
+ printf ("%p is %d\n", &var, var); // break on this line
+ return ++var;
+}
OpenPOWER on IntegriCloud