[Lldb-commits] [lldb] r116346 - in /lldb/trunk/test/breakpoint_locations: TestBreakpointLocations.py main.c

Johnny Chen johnny.chen at apple.com
Tue Oct 12 14:57:42 PDT 2010


Author: johnny
Date: Tue Oct 12 16:57:42 2010
New Revision: 116346

URL: http://llvm.org/viewvc/llvm-project?rev=116346&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/breakpoint_locations/TestBreakpointLocations.py
    lldb/trunk/test/breakpoint_locations/main.c

Modified: lldb/trunk/test/breakpoint_locations/TestBreakpointLocations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_locations/TestBreakpointLocations.py?rev=116346&r1=116345&r2=116346&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_locations/TestBreakpointLocations.py (original)
+++ lldb/trunk/test/breakpoint_locations/TestBreakpointLocations.py Tue Oct 12 16:57:42 2010
@@ -22,18 +22,25 @@
         self.buildDwarf()
         self.breakpoint_locations_test()
 
+    def setUp(self):
+        super(BreakpointLocationsTestCase, self).setUp()
+        # Find the line number to break inside main().
+        self.line = line_number('main.c', '// Set break point at this line.')
+
     def breakpoint_locations_test(self):
         """Test breakpoint enable/disable for a breakpoint ID with multiple locations."""
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # This should create a breakpoint with 3 locations.
-        self.expect("breakpoint set -f main.c -l 19", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = 19, locations = 3")
+        self.expect("breakpoint set -f main.c -l %d" % self.line,
+                    BREAKPOINT_CREATED,
+            startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 3" %
+                        self.line)
 
         # The breakpoint list should show 3 locations.
         self.expect("breakpoint list", "Breakpoint locations shown correctly",
-            substrs = ["1: file ='main.c', line = 19, locations = 3"],
+            substrs = ["1: file ='main.c', line = %d, locations = 3" % self.line],
             patterns = ["where = a.out`func_inlined .+unresolved, hit count = 0",
                         "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])
 

Modified: lldb/trunk/test/breakpoint_locations/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_locations/main.c?rev=116346&r1=116345&r2=116346&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_locations/main.c (original)
+++ lldb/trunk/test/breakpoint_locations/main.c Tue Oct 12 16:57:42 2010
@@ -16,7 +16,7 @@
     printf ("Called func_inlined.\n");
     ++func_inline_call_count;
     printf ("Returning func_inlined call count: %d.\n", func_inline_call_count);
-    return func_inline_call_count;
+    return func_inline_call_count; // Set break point at this line.
 }
 
 extern int func_inlined (void);





More information about the lldb-commits mailing list