Make sure the "synchronous breakpoint callbacks" get called before the thread plan logic gets invoked, and if they
ask to continue that should short-circuit the thread plans for that thread. Also add a bit more explanation for
how this machinery is supposed to work.
Also pass eExecutionPolicyOnlyWhenNeeded, not eExecutionPolicyAlways when evaluating the expression for breakpoint
conditions.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155236 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/StopInfo.cpp b/source/Target/StopInfo.cpp
index d5ef53b..113aa57 100644
--- a/source/Target/StopInfo.cpp
+++ b/source/Target/StopInfo.cpp
@@ -134,7 +134,7 @@
}
virtual bool
- ShouldStop (Event *event_ptr)
+ ShouldStopSynchronous (Event *event_ptr)
{
if (!m_should_stop_is_valid)
{
@@ -160,6 +160,15 @@
return m_should_stop;
}
+ bool
+ ShouldStop (Event *event_ptr)
+ {
+ // This just reports the work done by PerformAction or the synchronous stop. It should
+ // only ever get called after they have had a chance to run.
+ assert (m_should_stop_is_valid);
+ return m_should_stop;
+ }
+
virtual void
PerformAction (Event *event_ptr)
{
@@ -216,7 +225,7 @@
const bool discard_on_error = true;
Error error;
result_code = ClangUserExpression::EvaluateWithError (exe_ctx,
- eExecutionPolicyAlways,
+ eExecutionPolicyOnlyWhenNeeded,
lldb::eLanguageTypeUnknown,
ClangUserExpression::eResultTypeAny,
discard_on_error,
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index c483e5a..7445ffc 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -333,6 +333,17 @@
// The top most plan always gets to do the trace log...
current_plan->DoTraceLog ();
+
+ // First query the stop info's ShouldStopSynchronous. This handles "synchronous" stop reasons, for example the breakpoint
+ // command on internal breakpoints. If a synchronous stop reason says we should not stop, then we don't have to
+ // do any more work on this stop.
+ StopInfoSP private_stop_info (GetPrivateStopReason());
+ if (private_stop_info && private_stop_info->ShouldStopSynchronous(event_ptr) == false)
+ {
+ if (log)
+ log->Printf ("StopInfo::ShouldStop async callback says we should not stop, returning ShouldStop of false.");
+ return false;
+ }
// If the base plan doesn't understand why we stopped, then we have to find a plan that does.
// If that plan is still working, then we don't need to do any more work. If the plan that explains
diff --git a/source/Target/ThreadPlanStepRange.cpp b/source/Target/ThreadPlanStepRange.cpp
index 59f760c..113e459 100644
--- a/source/Target/ThreadPlanStepRange.cpp
+++ b/source/Target/ThreadPlanStepRange.cpp
@@ -368,6 +368,9 @@
case eStopReasonBreakpoint:
if (NextRangeBreakpointExplainsStop(stop_info_sp))
return true;
+ else
+ return false;
+ break;
case eStopReasonWatchpoint:
case eStopReasonSignal:
case eStopReasonException: