[Lldb-commits] [lldb] r177198 - Rework TestChangedValueAPI.py to account for gcc setting multiple breakpoints.

Matt Kopec Matt.Kopec at intel.com
Fri Mar 15 15:49:53 PDT 2013


Author: mkopec
Date: Fri Mar 15 17:49:52 2013
New Revision: 177198

URL: http://llvm.org/viewvc/llvm-project?rev=177198&view=rev
Log:
Rework TestChangedValueAPI.py to account for gcc setting multiple breakpoints.

Modified:
    lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py
    lldb/trunk/test/python_api/value/change_values/main.c

Modified: lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py?rev=177198&r1=177197&r2=177198&view=diff
==============================================================================
--- lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py (original)
+++ lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py Fri Mar 15 17:49:52 2013
@@ -38,9 +38,9 @@ class ChangeValueAPITestCase(TestBase):
         self.exe_name = self.testMethodName
         # Find the line number to of function 'c'.
         self.line = line_number('main.c', '// Stop here and set values')
+        self.check_line = line_number('main.c', '// Stop here and check values')
         self.end_line = line_number ('main.c', '// Set a breakpoint here at the end')
 
-    @expectedFailureGcc # PR-15039: If GCC is the test compiler, stdout is not available via lldb.SBProcess.GetSTDOUT()
     def change_value_api(self, exe_name):
         """Exercise some SBValue APIs."""
         exe = os.path.join(os.getcwd(), exe_name)
@@ -53,6 +53,10 @@ class ChangeValueAPITestCase(TestBase):
         breakpoint = target.BreakpointCreateByLocation('main.c', self.line)
         self.assertTrue(breakpoint, VALID_BREAKPOINT)
 
+        # Create the breakpoint inside the function 'main'
+        check_breakpoint = target.BreakpointCreateByLocation('main.c', self.check_line)
+        self.assertTrue(check_breakpoint, VALID_BREAKPOINT)
+
         # Create the breakpoint inside function 'main'.
         end_breakpoint = target.BreakpointCreateByLocation('main.c', self.end_line)
         self.assertTrue(end_breakpoint, VALID_BREAKPOINT)
@@ -116,8 +120,16 @@ class ChangeValueAPITestCase(TestBase):
         self.assertTrue (error.Success(), "Got a changed value from ptr->second_val")
         self.assertTrue (actual_value == 98765, "Got the right changed value from ptr->second_val")
         
-        # Now step, grab the stdout and make sure we changed the real values as well...
-        thread.StepOver()
+        # gcc may set multiple locations for breakpoint
+        breakpoint.SetEnabled(False)
+
+        # Now continue, grab the stdout and make sure we changed the real values as well...
+        process.Continue();
+
+        self.assertTrue(process.GetState() == lldb.eStateStopped)
+        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+
         expected_value = "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
         stdout = process.GetSTDOUT(1000)
         self.assertTrue (expected_value in stdout, "STDOUT showed changed values.")

Modified: lldb/trunk/test/python_api/value/change_values/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/change_values/main.c?rev=177198&r1=177197&r2=177198&view=diff
==============================================================================
--- lldb/trunk/test/python_api/value/change_values/main.c (original)
+++ lldb/trunk/test/python_api/value/change_values/main.c Fri Mar 15 17:49:52 2013
@@ -24,6 +24,7 @@ int main ()
           mine.first_val, mine.second_val, mine.third_val,
           ptr->first_val, ptr->second_val, ptr->third_val); 
 
+  // Stop here and check values
   printf ("This is just another call which we won't make it over %d.", val);
   return 0; // Set a breakpoint here at the end
 }





More information about the lldb-commits mailing list