[Lldb-commits] [lldb] r161271 - in /lldb/trunk: include/lldb/Target/Process.h source/Expression/ClangFunction.cpp source/Target/Target.cpp

Enrico Granata egranata at apple.com
Fri Aug 3 15:24:48 PDT 2012


Author: enrico
Date: Fri Aug  3 17:24:48 2012
New Revision: 161271

URL: http://llvm.org/viewvc/llvm-project?rev=161271&view=rev
Log:
<rdar://problem/12027563> Making sure that some class of stop-hook commands that involve po'ing objects do not cause an endless recursion

Modified:
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=161271&r1=161270&r2=161271&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Aug  3 17:24:48 2012
@@ -1212,6 +1212,12 @@
         return m_stop_id != UINT32_MAX;
     }
     
+    bool
+    IsLastResumeForUserExpression () const
+    {
+        return m_resume_id == m_last_user_expression_resume;
+    }
+    
     void
     SetRunningUserExpression (bool on)
     {

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=161271&r1=161270&r2=161271&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Aug  3 17:24:48 2012
@@ -504,13 +504,23 @@
     
     call_plan_sp->SetPrivate(true);
     
-    return exe_ctx.GetProcessRef().RunThreadPlan (exe_ctx, call_plan_sp, 
-                                                  stop_others, 
-                                                  try_all_threads, 
-                                                  discard_on_error,
-                                                  single_thread_timeout_usec, 
-                                                  errors);
-}  
+    // <rdar://problem/12027563> we need to make sure we record the fact that we are running an expression here
+    // otherwise this fact will fail to be recorded when fetching an Objective-C object description
+    if (exe_ctx.GetProcessPtr())
+        exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
+    
+    ExecutionResults results = exe_ctx.GetProcessRef().RunThreadPlan (exe_ctx, call_plan_sp,
+                                                                      stop_others, 
+                                                                      try_all_threads, 
+                                                                      discard_on_error,
+                                                                      single_thread_timeout_usec, 
+                                                                      errors);
+    
+    if (exe_ctx.GetProcessPtr())
+        exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
+    
+    return results;
+}
 
 ExecutionResults
 ClangFunction::ExecuteFunction(

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=161271&r1=161270&r2=161271&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Aug  3 17:24:48 2012
@@ -1935,7 +1935,12 @@
         
     if (!m_process_sp)
         return;
-        
+    
+    // <rdar://problem/12027563> make sure we check that we are not stopped because of us running a user expression
+    // since in that case we do not want to run the stop-hooks
+    if (m_process_sp->GetModIDRef().IsLastResumeForUserExpression())
+        return;
+    
     if (m_stop_hooks.empty())
         return;
         





More information about the lldb-commits mailing list