summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-04-02 19:46:14 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-04-02 19:46:14 +0000
commitd6fbc8ff664f39fb7b72ac4b21020e743cf410a1 (patch)
tree28091fcf330727313cf2f4d774b5cd1a685f87f4
parent2e5c58e77bac3469528c86847522716be44b4f9a (diff)
downloadbcm5719-llvm-d6fbc8ff664f39fb7b72ac4b21020e743cf410a1.tar.gz
bcm5719-llvm-d6fbc8ff664f39fb7b72ac4b21020e743cf410a1.zip
Add testcase that verifies that __apple_types is a valid section in a .o file generated by clang.
rdar://problem/11167268 llvm-svn: 153891
-rw-r--r--lldb/test/macosx/debug-info/apple_types/Makefile6
-rw-r--r--lldb/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py60
-rw-r--r--lldb/test/macosx/debug-info/apple_types/main.c27
3 files changed, 93 insertions, 0 deletions
diff --git a/lldb/test/macosx/debug-info/apple_types/Makefile b/lldb/test/macosx/debug-info/apple_types/Makefile
new file mode 100644
index 00000000000..aa3a0fcdcea
--- /dev/null
+++ b/lldb/test/macosx/debug-info/apple_types/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+MAKE_DSYM := NO
+
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py b/lldb/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
new file mode 100644
index 00000000000..551aa411b78
--- /dev/null
+++ b/lldb/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
@@ -0,0 +1,60 @@
+"""
+Test that clang produces the __apple accelerator tables, for example, __apple_types, correctly.
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+from lldbutil import symbol_type_to_str
+
+class AppleTypesTestCase(TestBase):
+
+ mydir = os.path.join("macosx", "debug-info", "apple_types")
+
+ #rdar://problem/11166975
+ @unittest2.expectedFailure
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_debug_info_for_apple_types(self):
+ """Test that __apple_types section does get produced by clang."""
+
+ if not self.getCompiler().endswith('clang'):
+ self.skipTest("clang compiler only test")
+
+ self.buildDefault()
+ self.apple_types()
+
+ def apple_types(self):
+ """Test that __apple_types section does get produced by clang."""
+ exe = os.path.join(os.getcwd(), "main.o")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+ self.assertTrue(target.GetNumModules() > 0)
+
+ # Hide stdout if not running with '-t' option.
+ if not self.TraceOn():
+ self.HideStdout()
+
+ print "Number of modules for the target: %d" % target.GetNumModules()
+ for module in target.module_iter():
+ print module
+
+ # Get the executable module at index 0.
+ exe_module = target.GetModuleAtIndex(0)
+
+ debug_str_section = exe_module.FindSection("__debug_str")
+ self.assertTrue(debug_str_section)
+ print "__debug_str section:", debug_str_section
+
+ # Find our __apple_types section by name.
+ apple_types_section = exe_module.FindSection("__apple_types")
+ self.assertTrue(apple_types_section)
+ print "__apple_types section:", apple_types_section
+
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
diff --git a/lldb/test/macosx/debug-info/apple_types/main.c b/lldb/test/macosx/debug-info/apple_types/main.c
new file mode 100644
index 00000000000..cb4bdb9c16b
--- /dev/null
+++ b/lldb/test/macosx/debug-info/apple_types/main.c
@@ -0,0 +1,27 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+int main (int argc, char const *argv[])
+{
+ struct point_tag {
+ int x;
+ int y;
+ }; // Set break point at this line.
+
+ struct rect_tag {
+ struct point_tag bottom_left;
+ struct point_tag top_right;
+ };
+ struct point_tag pt = { 2, 3 }; // This is the first executable statement.
+ struct rect_tag rect = {{1,2}, {3,4}};
+ pt.x = argc;
+ pt.y = argc * argc;
+ rect.top_right.x = rect.top_right.x + argc;
+ rect.top_right.y = rect.top_right.y + argc;
+ return 0;
+}
OpenPOWER on IntegriCloud