[Lldb-commits] [lldb] r116350 - in /lldb/trunk/test/enum_types: TestEnumTypes.py main.c

Johnny Chen johnny.chen at apple.com
Tue Oct 12 15:14:43 PDT 2010


Author: johnny
Date: Tue Oct 12 17:14:43 2010
New Revision: 116350

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

Modified: lldb/trunk/test/enum_types/TestEnumTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/enum_types/TestEnumTypes.py?rev=116350&r1=116349&r2=116350&view=diff
==============================================================================
--- lldb/trunk/test/enum_types/TestEnumTypes.py (original)
+++ lldb/trunk/test/enum_types/TestEnumTypes.py Tue Oct 12 17:14:43 2010
@@ -22,14 +22,21 @@
         self.buildDwarf()
         self.image_lookup_for_enum_type()
 
+    def setUp(self):
+        super(EnumTypesTestCase, self).setUp()
+        # Find the line number to break inside main().
+        self.line = line_number('main.c', '// Set break point at this line.')
+
     def image_lookup_for_enum_type(self):
         """Test 'image lookup -t days' and check for correct display."""
         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 26", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.c', line = 26, 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/enum_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/enum_types/main.c?rev=116350&r1=116349&r2=116350&view=diff
==============================================================================
--- lldb/trunk/test/enum_types/main.c (original)
+++ lldb/trunk/test/enum_types/main.c Tue Oct 12 17:14:43 2010
@@ -23,7 +23,7 @@
     enum days day;
     for (day = Monday - 1; day <= kNumDays + 1; day++)
     {
-        printf("day as int is %i\n", (int)day);
+        printf("day as int is %i\n", (int)day); // Set break point at this line.
     }
     return 0;
 }





More information about the lldb-commits mailing list