[Lldb-commits] [lldb] r116646 - in /lldb/trunk/test/conditional_break: TestConditionalBreak.py main.c

Johnny Chen johnny.chen at apple.com
Fri Oct 15 16:38:15 PDT 2010


Author: johnny
Date: Fri Oct 15 18:38:15 2010
New Revision: 116646

URL: http://llvm.org/viewvc/llvm-project?rev=116646&view=rev
Log:
Use line_number() utility function to find the number from main.c to test against
instead of using hard-coded line number.

Modified:
    lldb/trunk/test/conditional_break/TestConditionalBreak.py
    lldb/trunk/test/conditional_break/main.c

Modified: lldb/trunk/test/conditional_break/TestConditionalBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/conditional_break/TestConditionalBreak.py?rev=116646&r1=116645&r2=116646&view=diff
==============================================================================
--- lldb/trunk/test/conditional_break/TestConditionalBreak.py (original)
+++ lldb/trunk/test/conditional_break/TestConditionalBreak.py Fri Oct 15 18:38:15 2010
@@ -54,6 +54,10 @@
         self.assertTrue(self.process.GetState() == lldb.eStateStopped,
                         STOPPED_DUE_TO_BREAKPOINT)
 
+        # Find the line number where a's parent frame function is c.
+        line = line_number('main.c',
+            "// Find the line number where a's parent frame function is c here.")
+
         # Suppose we are only interested in the call scenario where c()'s
         # immediate caller is a() and we want to find out the value passed from
         # a().
@@ -71,11 +75,11 @@
                 #lldbutil.PrintStackTrace(thread)
                 self.assertTrue(name0 == "c", "Break on function c()")
                 if (name1 == "a"):
-                    line = frame1.GetLineEntry().GetLine()
                     # By design, we know that a() calls c() only from main.c:27.
                     # In reality, similar logic can be used to find out the call
                     # site.
-                    self.assertTrue(line == 27, "Immediate caller a() at main.c:27")
+                    self.assertTrue(frame1.GetLineEntry().GetLine() == line,
+                                    "Immediate caller a() at main.c:%d" % line)
 
                     # And the local variable 'val' should have a value of (int) 3.
                     val = frame1.LookupVar("val")

Modified: lldb/trunk/test/conditional_break/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/conditional_break/main.c?rev=116646&r1=116645&r2=116646&view=diff
==============================================================================
--- lldb/trunk/test/conditional_break/main.c (original)
+++ lldb/trunk/test/conditional_break/main.c Fri Oct 15 18:38:15 2010
@@ -24,7 +24,7 @@
     if (val <= 1)
         return b(val);
     else if (val >= 3)
-        return c(val);
+        return c(val); // Find the line number where a's parent frame function is c here.
 
     return val;
 }





More information about the lldb-commits mailing list