summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-05-01 18:38:37 +0000
committerJim Ingham <jingham@apple.com>2012-05-01 18:38:37 +0000
commitfbbfe6ecf0a400b26e6b6839a8d06bd8be46ad2a (patch)
tree77ba25a38fe31094ffaedcfcd976c855896b2822 /lldb/source/Target
parent758e0cc94af7e146c948aadaf81e2667287c777b (diff)
downloadbcm5719-llvm-fbbfe6ecf0a400b26e6b6839a8d06bd8be46ad2a.tar.gz
bcm5719-llvm-fbbfe6ecf0a400b26e6b6839a8d06bd8be46ad2a.zip
Fix reporting of stop reasons when the StepOver & StepIn plans stop because of a crash or breakpoint. Added the ability for a plan to say it is done but doesn't want to be the reason for the stop.
llvm-svn: 155927
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/Thread.cpp2
-rw-r--r--lldb/source/Target/ThreadPlan.cpp6
-rw-r--r--lldb/source/Target/ThreadPlanStepInRange.cpp38
-rw-r--r--lldb/source/Target/ThreadPlanStepOverRange.cpp38
-rw-r--r--lldb/source/Target/ThreadPlanStepRange.cpp36
5 files changed, 81 insertions, 39 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 7445ffc06f2..aaec66576d2 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -97,7 +97,7 @@ lldb::StopInfoSP
Thread::GetStopInfo ()
{
ThreadPlanSP plan_sp (GetCompletedPlan());
- if (plan_sp)
+ if (plan_sp && plan_sp->PlanSucceeded())
return StopInfo::CreateStopReasonWithPlan (plan_sp, GetReturnValueObject());
else
{
diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp
index 5f396d94755..22c2fc4b8ff 100644
--- a/lldb/source/Target/ThreadPlan.cpp
+++ b/lldb/source/Target/ThreadPlan.cpp
@@ -37,7 +37,8 @@ ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vo
m_plan_complete (false),
m_plan_private (false),
m_okay_to_discard (false),
- m_is_master_plan (false)
+ m_is_master_plan (false),
+ m_plan_succeeded(true)
{
SetID (GetNextID());
}
@@ -57,10 +58,11 @@ ThreadPlan::IsPlanComplete ()
}
void
-ThreadPlan::SetPlanComplete ()
+ThreadPlan::SetPlanComplete (bool success)
{
Mutex::Locker locker(m_plan_complete_mutex);
m_plan_complete = true;
+ m_plan_succeeded = success;
}
bool
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index 9fbca6b03f7..0db23a114b8 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -295,3 +295,41 @@ ThreadPlanStepInRange::DefaultShouldStopHereCallback (ThreadPlan *current_plan,
return NULL;
}
+
+bool
+ThreadPlanStepInRange::PlanExplainsStop ()
+{
+ // We always explain a stop. Either we've just done a single step, in which
+ // case we'll do our ordinary processing, or we stopped for some
+ // reason that isn't handled by our sub-plans, in which case we want to just stop right
+ // away.
+ // We also set ourselves complete when we stop for this sort of unintended reason, but mark
+ // success as false so we don't end up being the reason for the stop.
+ //
+ // The only variation is that if we are doing "step by running to next branch" in which case
+ // if we hit our branch breakpoint we don't set the plan to complete.
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ StopInfoSP stop_info_sp = GetPrivateStopReason();
+ if (stop_info_sp)
+ {
+ StopReason reason = stop_info_sp->GetStopReason();
+
+ switch (reason)
+ {
+ case eStopReasonBreakpoint:
+ if (NextRangeBreakpointExplainsStop(stop_info_sp))
+ return true;
+ case eStopReasonWatchpoint:
+ case eStopReasonSignal:
+ case eStopReasonException:
+ if (log)
+ log->PutCString ("ThreadPlanStepInRange got asked if it explains the stop for some reason other than step.");
+ SetPlanComplete(false);
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+}
diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp
index c147e83b19e..933983bb7d1 100644
--- a/lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -170,3 +170,41 @@ ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
else
return false;
}
+
+bool
+ThreadPlanStepOverRange::PlanExplainsStop ()
+{
+ // For crashes, breakpoint hits, signals, etc, let the base plan (or some plan above us)
+ // handle the stop. That way the user can see the stop, step around, and then when they
+ // are done, continue and have their step complete. The exception is if we've hit our
+ // "run to next branch" breakpoint.
+ // Note, unlike the step in range plan, we don't mark ourselves complete if we hit an
+ // unexplained breakpoint/crash.
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ StopInfoSP stop_info_sp = GetPrivateStopReason();
+ if (stop_info_sp)
+ {
+ StopReason reason = stop_info_sp->GetStopReason();
+
+ switch (reason)
+ {
+ case eStopReasonBreakpoint:
+ if (NextRangeBreakpointExplainsStop(stop_info_sp))
+ return true;
+ else
+ return false;
+ break;
+ case eStopReasonWatchpoint:
+ case eStopReasonSignal:
+ case eStopReasonException:
+ if (log)
+ log->PutCString ("ThreadPlanStepInRange got asked if it explains the stop for some reason other than step.");
+ return false;
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+}
diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index 113e45963ea..91fc998fbaa 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -350,42 +350,6 @@ ThreadPlanStepRange::NextRangeBreakpointExplainsStop (lldb::StopInfoSP stop_info
}
bool
-ThreadPlanStepRange::PlanExplainsStop ()
-{
- // We always explain a stop. Either we've just done a single step, in which
- // case we'll do our ordinary processing, or we stopped for some
- // reason that isn't handled by our sub-plans, in which case we want to just stop right
- // away.
-
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
- StopInfoSP stop_info_sp = GetPrivateStopReason();
- if (stop_info_sp)
- {
- StopReason reason = stop_info_sp->GetStopReason();
-
- switch (reason)
- {
- case eStopReasonBreakpoint:
- if (NextRangeBreakpointExplainsStop(stop_info_sp))
- return true;
- else
- return false;
- break;
- case eStopReasonWatchpoint:
- case eStopReasonSignal:
- case eStopReasonException:
- if (log)
- log->PutCString ("ThreadPlanStepInRange got asked if it explains the stop for some reason other than step.");
- SetPlanComplete();
- break;
- default:
- break;
- }
- }
- return true;
-}
-
-bool
ThreadPlanStepRange::WillStop ()
{
return true;
OpenPOWER on IntegriCloud