[Lldb-commits] [lldb] r116352 - in /lldb/trunk/test/function_types: TestFunctionTypes.py main.c

Johnny Chen johnny.chen at apple.com
Tue Oct 12 15:19:26 PDT 2010


Author: johnny
Date: Tue Oct 12 17:19:26 2010
New Revision: 116352

URL: http://llvm.org/viewvc/llvm-project?rev=116352&view=rev
Log:
Avoid using hardcoded line number to break on.  Use the line_number() utility
function to get the line number to break on during setUp().

Modified:
    lldb/trunk/test/function_types/TestFunctionTypes.py
    lldb/trunk/test/function_types/main.c

Modified: lldb/trunk/test/function_types/TestFunctionTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/function_types/TestFunctionTypes.py?rev=116352&r1=116351&r2=116352&view=diff
==============================================================================
--- lldb/trunk/test/function_types/TestFunctionTypes.py (original)
+++ lldb/trunk/test/function_types/TestFunctionTypes.py Tue Oct 12 17:19:26 2010
@@ -20,14 +20,21 @@
         self.buildDwarf()
         self.function_types()
 
+    def setUp(self):
+        super(FunctionTypesTestCase, self).setUp()
+        # Find the line number to break inside main().
+        self.line = line_number('main.c', '// Set break point at this line.')
+
     def function_types(self):
         """Test 'callback' has function ptr type, then break on the function."""
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the main.
-        self.expect("breakpoint set -f main.c -l 21", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = 21, locations = 1")
+        self.expect("breakpoint set -f main.c -l %d" % self.line,
+                    BREAKPOINT_CREATED,
+            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
+                        self.line)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/trunk/test/function_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/function_types/main.c?rev=116352&r1=116351&r2=116352&view=diff
==============================================================================
--- lldb/trunk/test/function_types/main.c (original)
+++ lldb/trunk/test/function_types/main.c Tue Oct 12 17:19:26 2010
@@ -18,5 +18,5 @@
 {
     int (*callback)(const char *) = string_not_empty;
 
-    return callback(0);
+    return callback(0); // Set break point at this line.
 }





More information about the lldb-commits mailing list