Rework TestChangedValueAPI.py to account for gcc setting multiple breakpoints.
authorMatt Kopec <Matt.Kopec@intel.com>
Fri, 15 Mar 2013 22:49:52 +0000 (22:49 +0000)
committerMatt Kopec <Matt.Kopec@intel.com>
Fri, 15 Mar 2013 22:49:52 +0000 (22:49 +0000)
llvm-svn: 177198

lldb/test/python_api/value/change_values/TestChangeValueAPI.py
lldb/test/python_api/value/change_values/main.c

index fb5c294..b84b3dc 100644 (file)
@@ -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.")
index a9cff8e..5444347 100644 (file)
@@ -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
 }