[Lldb-commits] [lldb] r153891 - in /lldb/trunk/test/macosx/debug-info/apple_types: ./ Makefile TestAppleTypesIsProduced.py main.c
Johnny Chen
johnny.chen at apple.com
Mon Apr 2 12:46:14 PDT 2012
Author: johnny
Date: Mon Apr 2 14:46:14 2012
New Revision: 153891
URL: http://llvm.org/viewvc/llvm-project?rev=153891&view=rev
Log:
Add testcase that verifies that __apple_types is a valid section in a .o file generated by clang.
rdar://problem/11167268
Added:
lldb/trunk/test/macosx/debug-info/apple_types/
lldb/trunk/test/macosx/debug-info/apple_types/Makefile
lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
lldb/trunk/test/macosx/debug-info/apple_types/main.c
Added: lldb/trunk/test/macosx/debug-info/apple_types/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/debug-info/apple_types/Makefile?rev=153891&view=auto
==============================================================================
--- lldb/trunk/test/macosx/debug-info/apple_types/Makefile (added)
+++ lldb/trunk/test/macosx/debug-info/apple_types/Makefile Mon Apr 2 14:46:14 2012
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+MAKE_DSYM := NO
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py?rev=153891&view=auto
==============================================================================
--- lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py (added)
+++ lldb/trunk/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py Mon Apr 2 14:46:14 2012
@@ -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()
Added: lldb/trunk/test/macosx/debug-info/apple_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/debug-info/apple_types/main.c?rev=153891&view=auto
==============================================================================
--- lldb/trunk/test/macosx/debug-info/apple_types/main.c (added)
+++ lldb/trunk/test/macosx/debug-info/apple_types/main.c Mon Apr 2 14:46:14 2012
@@ -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;
+}
More information about the lldb-commits
mailing list