[Lldb-commits] [lldb] r182440 - <rdar://problem/13455021>
Greg Clayton
gclayton at apple.com
Tue May 21 16:58:54 PDT 2013
Author: gclayton
Date: Tue May 21 18:58:54 2013
New Revision: 182440
URL: http://llvm.org/viewvc/llvm-project?rev=182440&view=rev
Log:
<rdar://problem/13455021>
Add test case to make sure we don't regress on fat files full of skinny BSD archives.
Added:
lldb/trunk/test/functionalities/fat_archives/
lldb/trunk/test/functionalities/fat_archives/Makefile
lldb/trunk/test/functionalities/fat_archives/TestFatArchives.py
lldb/trunk/test/functionalities/fat_archives/a.c
lldb/trunk/test/functionalities/fat_archives/a.h
lldb/trunk/test/functionalities/fat_archives/main.c
Added: lldb/trunk/test/functionalities/fat_archives/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/fat_archives/Makefile?rev=182440&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/fat_archives/Makefile (added)
+++ lldb/trunk/test/functionalities/fat_archives/Makefile Tue May 21 18:58:54 2013
@@ -0,0 +1,12 @@
+all: clean
+ $(CC) -arch i386 -g -c a.c
+ ar -q liba-i386.a a.o
+ $(CC) -arch x86_64 -g -c a.c
+ ar -q liba-x86_64.a a.o
+ lipo -create -output liba.a liba-i386.a liba-x86_64.a
+ $(CC) -g -c main.c
+ $(CC) -o a.out main.o -L. -la
+
+clean:
+ rm -rf a.o a.out liba-i386.a liba-x86_64.a liba.a *un~ .*un~ main.o *.pyc
+
Added: lldb/trunk/test/functionalities/fat_archives/TestFatArchives.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/fat_archives/TestFatArchives.py?rev=182440&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/fat_archives/TestFatArchives.py (added)
+++ lldb/trunk/test/functionalities/fat_archives/TestFatArchives.py Tue May 21 18:58:54 2013
@@ -0,0 +1,63 @@
+"""
+Test some lldb command abbreviations.
+"""
+import commands
+import lldb
+import os
+import time
+import unittest2
+from lldbtest import *
+import lldbutil
+
+def execute_command (command):
+ # print '%% %s' % (command)
+ (exit_status, output) = commands.getstatusoutput (command)
+ # if output:
+ # print output
+ # print 'status = %u' % (exit_status)
+ return exit_status
+
+class FatArchiveTestCase(TestBase):
+
+ mydir = os.path.join("functionalities", "fat_archives")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @dwarf_test
+ def test_with_dwarf (self):
+ if self.getArchitecture() == 'x86_64':
+ execute_command ("make CC='%s'" % (os.environ["CC"]))
+ self.main ()
+ else:
+ self.skipTest("This test requires x86_64 as the architecture for the inferior")
+
+ def main (self):
+ '''This test compiles a quick example by making a fat file (universal) full of
+ skinny .o files and makes sure we can use them to resolve breakpoints when doing
+ DWARF in .o file debugging. The only thing this test needs to do is to compile and
+ set a breakpoint in the target and verify any breakpoint locations have valid debug
+ info for the function, and source file and line.'''
+ exe = os.path.join (os.getcwd(), "a.out")
+
+ # Create the target
+ target = self.dbg.CreateTarget(exe)
+
+ # Create a breakpoint by name
+ breakpoint = target.BreakpointCreateByName ('foo', exe)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Make sure the breakpoint resolves to a function, file and line
+ for bp_loc in breakpoint:
+ # Get a section offset address (lldb.SBAddress) from the breakpoint location
+ bp_loc_addr = bp_loc.GetAddress()
+ line_entry = bp_loc_addr.GetLineEntry()
+ function = bp_loc_addr.GetFunction()
+ self.assertTrue(function.IsValid(), "Verify breakpoint in fat BSD archive has valid function debug info")
+ self.assertTrue(line_entry.GetFileSpec(), "Verify breakpoint in fat BSD archive has source file information")
+ self.assertTrue(line_entry.GetLine() != 0, "Verify breakpoint in fat BSD archive has source line information")
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
+
Added: lldb/trunk/test/functionalities/fat_archives/a.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/fat_archives/a.c?rev=182440&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/fat_archives/a.c (added)
+++ lldb/trunk/test/functionalities/fat_archives/a.c Tue May 21 18:58:54 2013
@@ -0,0 +1,4 @@
+int foo ()
+{
+ return 5;
+}
Added: lldb/trunk/test/functionalities/fat_archives/a.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/fat_archives/a.h?rev=182440&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/fat_archives/a.h (added)
+++ lldb/trunk/test/functionalities/fat_archives/a.h Tue May 21 18:58:54 2013
@@ -0,0 +1 @@
+int foo ();
Added: lldb/trunk/test/functionalities/fat_archives/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/fat_archives/main.c?rev=182440&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/fat_archives/main.c (added)
+++ lldb/trunk/test/functionalities/fat_archives/main.c Tue May 21 18:58:54 2013
@@ -0,0 +1,6 @@
+#include "a.h"
+#include <stdio.h>
+int main()
+{
+ printf ("%d\n", foo());
+}
More information about the lldb-commits
mailing list