[Lldb-commits] [lldb] r182056 - Handle the case where there is a user breakpoint set at the location of one of our

Jim Ingham jingham at apple.com
Thu May 16 14:52:36 PDT 2013


Author: jingham
Date: Thu May 16 16:52:36 2013
New Revision: 182056

URL: http://llvm.org/viewvc/llvm-project?rev=182056&view=rev
Log:
Handle the case where there is a user breakpoint set at the location of one of our
function call exception catching breakpoints.  We need to force ourselves to stop in
that case.

<rdar://problem/13903801>

Modified:
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
    lldb/trunk/test/expression_command/call-throws/TestCallThatThrows.py

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=182056&r1=182055&r2=182056&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Thu May 16 16:52:36 2013
@@ -591,7 +591,15 @@ ThreadPlanCallFunction::BreakpointsExpla
        ||(m_objc_language_runtime &&
             m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp)))
     {
+        Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
+        if (log)
+            log->Printf ("ThreadPlanCallFunction::BreakpointsExplainStop - Hit an exception breakpoint, setting plan complete.");
+        
         SetPlanComplete(false);
+        
+        // If the user has set the ObjC language breakpoint, it would normally get priority over our internal
+        // catcher breakpoint, but in this case we can't let that happen, so force the ShouldStop here.
+        stop_info_sp->OverrideShouldStop (true);
         return true;
     }
     

Modified: lldb/trunk/test/expression_command/call-throws/TestCallThatThrows.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/call-throws/TestCallThatThrows.py?rev=182056&r1=182055&r2=182056&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/call-throws/TestCallThatThrows.py (original)
+++ lldb/trunk/test/expression_command/call-throws/TestCallThatThrows.py Thu May 16 16:52:36 2013
@@ -1,5 +1,5 @@
 """
-Test calling a function that hits a signal set to auto-restart, make sure the call completes.
+Test calling a function that throws an ObjC exception, make sure that it doesn't propagate the exception.
 """
 
 import unittest2
@@ -7,7 +7,7 @@ import lldb
 import lldbutil
 from lldbtest import *
 
-class ExprCommandWithTimeoutsTestCase(TestBase):
+class ExprCommandWithThrowTestCase(TestBase):
 
     mydir = os.path.join("expression_command", "call-throws")
 
@@ -22,14 +22,14 @@ class ExprCommandWithTimeoutsTestCase(Te
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_with_dsym(self):
-        """Test calling std::String member function."""
+        """Test calling a function that throws and ObjC exception."""
         self.buildDsym()
         self.call_function()
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin due to ObjC test case")
     @dwarf_test
     def test_with_dwarf(self):
-        """Test calling std::String member function."""
+        """Test calling a function that throws and ObjC exception."""
         self.buildDwarf()
         self.call_function()
 
@@ -40,7 +40,7 @@ class ExprCommandWithTimeoutsTestCase(Te
 
         
     def call_function(self):
-        """Test calling function with timeout."""
+        """Test calling function that throws."""
         exe_name = "a.out"
         exe = os.path.join(os.getcwd(), exe_name)
 
@@ -81,6 +81,18 @@ class ExprCommandWithTimeoutsTestCase(Te
         options.SetIgnoreBreakpoints(True)
         options.SetUnwindOnError(True)
 
+        value = frame.EvaluateExpression ("[my_class callMeIThrow]", options)
+
+        self.assertTrue (value.IsValid() and value.GetError().Success() == False)
+        self.check_after_call()
+
+        # Now set the ObjC language breakpoint and make sure that doesn't interfere with the call:
+        exception_bkpt = target.BreakpointCreateForException (lldb.eLanguageTypeObjC, False, True)
+        self.assertTrue(exception_bkpt.GetNumLocations() > 0)
+
+        options.SetIgnoreBreakpoints(True)
+        options.SetUnwindOnError(True)
+
         value = frame.EvaluateExpression ("[my_class callMeIThrow]", options)
 
         self.assertTrue (value.IsValid() and value.GetError().Success() == False)





More information about the lldb-commits mailing list