[Lldb-commits] [lldb] r131219 - in /lldb/trunk: include/lldb/Target/Target.h source/Target/Target.cpp

Jim Ingham jingham at apple.com
Wed May 11 19:06:14 PDT 2011


Author: jingham
Date: Wed May 11 21:06:14 2011
New Revision: 131219

URL: http://llvm.org/viewvc/llvm-project?rev=131219&view=rev
Log:
Target::EvaluateExpression should suppress stop hooks.

Modified:
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=131219&r1=131218&r2=131219&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Wed May 11 21:06:14 2011
@@ -591,6 +591,20 @@
     size_t
     GetStopHookSize();
     
+    bool
+    SetSuppresStopHooks (bool suppress)
+    {
+        bool old_value = m_suppress_stop_hooks;
+        m_suppress_stop_hooks = suppress;
+        return old_value;
+    }
+    
+    bool
+    GetSuppressStopHooks ()
+    {
+        return m_suppress_stop_hooks;
+    }
+    
 //    StopHookSP &
 //    GetStopHookByIndex (size_t index);
 //    
@@ -709,6 +723,7 @@
     typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
     StopHookCollection      m_stop_hooks;
     lldb::user_id_t         m_stop_hook_next_id;
+    bool                    m_suppress_stop_hooks;
     
     //------------------------------------------------------------------
     // Methods.

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=131219&r1=131218&r2=131219&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed May 11 21:06:14 2011
@@ -59,7 +59,8 @@
     m_scratch_ast_context_ap (NULL),
     m_persistent_variables (),
     m_stop_hooks (),
-    m_stop_hook_next_id (0)
+    m_stop_hook_next_id (0),
+    m_suppress_stop_hooks (false)
 {
     SetEventName (eBroadcastBitBreakpointChanged, "breakpoint-changed");
     SetEventName (eBroadcastBitModulesLoaded, "modules-loaded");
@@ -900,6 +901,11 @@
     ExecutionResults execution_results = eExecutionSetupError;
 
     result_valobj_sp.reset();
+    
+    // We shouldn't run stop hooks in expressions.
+    // Be sure to reset this if you return anywhere within this function.
+    bool old_suppress_value = m_suppress_stop_hooks;
+    m_suppress_stop_hooks = true;
 
     ExecutionContext exe_ctx;
     if (frame)
@@ -1002,6 +1008,9 @@
                                                                result_valobj_sp);
         }
     }
+    
+    m_suppress_stop_hooks = old_suppress_value;
+    
     return execution_results;
 }
 
@@ -1068,6 +1077,9 @@
 void
 Target::RunStopHooks ()
 {
+    if (m_suppress_stop_hooks)
+        return;
+        
     if (!m_process_sp)
         return;
         





More information about the lldb-commits mailing list