From 6026ca378d5cf87411b8502673f601dc9f7ee03d Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 12 May 2011 02:06:14 +0000 Subject: [PATCH] Target::EvaluateExpression should suppress stop hooks. llvm-svn: 131219 --- lldb/include/lldb/Target/Target.h | 15 +++++++++++++++ lldb/source/Target/Target.cpp | 14 +++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 5c57952b78c1..316eb1d00611 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -591,6 +591,20 @@ public: 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 @@ protected: typedef std::map StopHookCollection; StopHookCollection m_stop_hooks; lldb::user_id_t m_stop_hook_next_id; + bool m_suppress_stop_hooks; //------------------------------------------------------------------ // Methods. diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 942d0816585a..387a3363113e 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -59,7 +59,8 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat 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 @@ Target::EvaluateExpression 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 @@ Target::EvaluateExpression result_valobj_sp); } } + + m_suppress_stop_hooks = old_suppress_value; + return execution_results; } @@ -1068,6 +1077,9 @@ Target::SetAllStopHooksActiveState (bool active_state) void Target::RunStopHooks () { + if (m_suppress_stop_hooks) + return; + if (!m_process_sp) return;