summaryrefslogtreecommitdiffstats
path: root/lldb/include
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/Target/Process.h17
-rw-r--r--lldb/include/lldb/Target/StopInfo.h28
-rw-r--r--lldb/include/lldb/Target/Thread.h7
-rw-r--r--lldb/include/lldb/Target/ThreadList.h3
-rw-r--r--lldb/include/lldb/Target/ThreadPlan.h36
-rw-r--r--lldb/include/lldb/Target/ThreadPlanBase.h5
-rw-r--r--lldb/include/lldb/Target/ThreadPlanCallFunction.h9
-rw-r--r--lldb/include/lldb/Target/ThreadPlanRunToAddress.h6
-rw-r--r--lldb/include/lldb/Target/ThreadPlanStepInRange.h9
-rw-r--r--lldb/include/lldb/Target/ThreadPlanStepInstruction.h3
-rw-r--r--lldb/include/lldb/Target/ThreadPlanStepOut.h4
-rw-r--r--lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h4
-rw-r--r--lldb/include/lldb/Target/ThreadPlanStepOverRange.h4
-rw-r--r--lldb/include/lldb/Target/ThreadPlanStepThrough.h5
-rw-r--r--lldb/include/lldb/Target/ThreadPlanStepUntil.h5
15 files changed, 102 insertions, 43 deletions
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 224efe3782c..dd8ccedade7 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -3348,13 +3348,15 @@ public:
void
RestoreProcessEvents ();
-protected:
+private:
//------------------------------------------------------------------
/// This is the part of the event handling that for a process event.
/// It decides what to do with the event and returns true if the
/// event needs to be propagated to the user, and false otherwise.
/// If the event is not propagated, this call will most likely set
/// the target to executing again.
+ /// There is only one place where this call should be called, HandlePrivateEvent.
+ /// Don't call it from anywhere else...
///
/// @param[in] event_ptr
/// This is the event we are handling.
@@ -3526,6 +3528,9 @@ protected:
// new "NextEventAction" is added while one is already present, the
// old action will be discarded (with HandleBeingUnshipped called
// after it is discarded.)
+ //
+ // If you want to resume the process as a result of a resume action,
+ // call RequestResume, don't call Resume directly.
//------------------------------------------------------------------
class NextEventAction
{
@@ -3551,6 +3556,10 @@ protected:
virtual void HandleBeingUnshipped () {}
virtual EventActionResult HandleBeingInterrupted () = 0;
virtual const char *GetExitString() = 0;
+ void RequestResume()
+ {
+ m_process->m_resume_requested = true;
+ }
protected:
Process *m_process;
};
@@ -3661,7 +3670,9 @@ protected:
#if defined(__APPLE__)
ReadWriteLock m_private_run_lock;
#endif
- Predicate<bool> m_currently_handling_event;
+ Predicate<bool> m_currently_handling_event; // This predicate is set in HandlePrivateEvent while all its business is being done.
+ bool m_currently_handling_do_on_removals;
+ bool m_resume_requested; // If m_currently_handling_event or m_currently_handling_do_on_removals are true, Resume will only request a resume, using this flag to check.
bool m_finalize_called;
lldb::StateType m_last_broadcast_state; /// This helps with the Public event coalescing in ShouldBroadcastEvent.
bool m_destroy_in_process;
@@ -3679,7 +3690,7 @@ protected:
SynchronouslyNotifyStateChanged (lldb::StateType state);
void
- SetPublicState (lldb::StateType new_state);
+ SetPublicState (lldb::StateType new_state, bool restarted);
void
SetPrivateState (lldb::StateType state);
diff --git a/lldb/include/lldb/Target/StopInfo.h b/lldb/include/lldb/Target/StopInfo.h
index c4f243ea1ad..3435d392e2b 100644
--- a/lldb/include/lldb/Target/StopInfo.h
+++ b/lldb/include/lldb/Target/StopInfo.h
@@ -79,11 +79,20 @@ public:
return true;
}
+ void
+ OverrideShouldNotify (bool override_value)
+ {
+ m_override_should_notify = override_value ? eLazyBoolYes : eLazyBoolNo;
+ }
+
// If should stop returns false, check if we should notify of this event
virtual bool
ShouldNotify (Event *event_ptr)
{
- return false;
+ if (m_override_should_notify == eLazyBoolCalculate)
+ return DoShouldNotify (event_ptr);
+ else
+ return m_override_should_notify == eLazyBoolYes;
}
virtual void
@@ -116,20 +125,19 @@ public:
void
OverrideShouldStop (bool override_value)
{
- m_override_set = true;
- m_override_value = override_value;
+ m_override_should_stop = override_value ? eLazyBoolYes : eLazyBoolNo;
}
bool
GetOverrideShouldStop()
{
- return m_override_set;
+ return m_override_should_stop != eLazyBoolCalculate;
}
bool
GetOverriddenShouldStopValue ()
{
- return m_override_value;
+ return m_override_should_stop == eLazyBoolYes;
}
static lldb::StopInfoSP
@@ -169,6 +177,12 @@ protected:
{
}
+ virtual bool
+ DoShouldNotify (Event *event_ptr)
+ {
+ return false;
+ }
+
// Stop the thread by default. Subclasses can override this to allow
// the thread to continue if desired. The ShouldStop method should not do anything
// that might run code. If you need to run code when deciding whether to stop
@@ -189,8 +203,8 @@ protected:
uint32_t m_resume_id; // This is the resume ID when we made this stop ID.
uint64_t m_value; // A generic value that can be used for things pertaining to this stop info
std::string m_description; // A textual description describing this stop.
- bool m_override_set;
- bool m_override_value;
+ LazyBool m_override_should_notify;
+ LazyBool m_override_should_stop;
// This determines whether the target has run since this stop info.
// N.B. running to evaluate a user expression does not count.
diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h
index c1cd2a75d42..f1f8439e2a4 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -288,7 +288,7 @@ public:
Vote
ShouldReportStop (Event *event_ptr);
-
+
Vote
ShouldReportRun (Event *event_ptr);
@@ -927,6 +927,9 @@ public:
void
SetStopInfo (const lldb::StopInfoSP &stop_info_sp);
+ void
+ SetShouldReportStop (Vote vote);
+
protected:
friend class ThreadPlan;
@@ -1015,7 +1018,7 @@ protected:
bool m_destroy_called; // This is used internally to make sure derived Thread classes call DestroyThread.
uint32_t m_thread_stop_reason_stop_id; // This is the stop id for which the StopInfo is valid. Can use this so you know that
// the thread's m_actual_stop_info_sp is current and you don't have to fetch it again
-
+ LazyBool m_override_should_notify;
private:
//------------------------------------------------------------------
// For Thread only
diff --git a/lldb/include/lldb/Target/ThreadList.h b/lldb/include/lldb/Target/ThreadList.h
index f1d699d8ffb..959091c81bf 100644
--- a/lldb/include/lldb/Target/ThreadList.h
+++ b/lldb/include/lldb/Target/ThreadList.h
@@ -137,6 +137,9 @@ public:
protected:
void
+ SetShouldReportStop (Vote vote);
+
+ void
NotifySelectedThreadChanged (lldb::tid_t tid);
typedef std::vector<lldb::ThreadSP> collection;
diff --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h
index 7a5fa101895..630fee3a9f2 100644
--- a/lldb/include/lldb/Target/ThreadPlan.h
+++ b/lldb/include/lldb/Target/ThreadPlan.h
@@ -92,7 +92,8 @@ namespace lldb_private {
// When the target process is about to be restarted, the plan's WillResume method is called,
// giving the plan a chance to prepare for the run. If WillResume returns false, then the
// process is not restarted. Be sure to set an appropriate error value in the Process if
-// you have to do this.
+// you have to do this. Note, ThreadPlans actually implement DoWillResume, WillResume wraps that call.
+//
// Next the "StopOthers" method of all the threads are polled, and if one thread's Current plan
// returns "true" then only that thread gets to run. If more than one returns "true" the threads that want to run solo
// get run one by one round robin fashion. Otherwise all are let to run.
@@ -115,6 +116,8 @@ namespace lldb_private {
// figure out what to do about the plans below it in the stack. If the stop is recoverable, then the plan that
// understands it can just do what it needs to set up to restart, and then continue.
// Otherwise, the plan that understood the stop should call DiscardPlanStack to clean up the stack below it.
+// Note, plans actually implement DoPlanExplainsStop, the result is cached in PlanExplainsStop so the DoPlanExplainsStop
+// itself will only get called once per stop.
//
// Master plans:
//
@@ -331,9 +334,6 @@ public:
virtual bool
ValidatePlan (Stream *error) = 0;
- virtual bool
- PlanExplainsStop (Event *event_ptr) = 0;
-
bool
TracerExplainsStop ()
{
@@ -347,6 +347,9 @@ public:
lldb::StateType
RunState ();
+ bool
+ PlanExplainsStop (Event *event_ptr);
+
virtual bool
ShouldStop (Event *event_ptr) = 0;
@@ -371,9 +374,11 @@ public:
virtual bool
StopOthers ();
- virtual bool
+ // This is the wrapper for DoWillResume that does generic ThreadPlan logic, then
+ // calls DoWillResume.
+ bool
WillResume (lldb::StateType resume_state, bool current_plan);
-
+
virtual bool
WillStop () = 0;
@@ -510,6 +515,12 @@ protected:
// Classes that inherit from ThreadPlan can see and modify these
//------------------------------------------------------------------
+ virtual bool
+ DoWillResume (lldb::StateType resume_state, bool current_plan) { return true; };
+
+ virtual bool
+ DoPlanExplainsStop (Event *event_ptr) = 0;
+
// This gets the previous plan to the current plan (for forwarding requests).
// This is mostly a formal requirement, it allows us to make the Thread's
// GetPreviousPlan protected, but only friend ThreadPlan to thread.
@@ -535,6 +546,18 @@ protected:
m_thread.SetStopInfo (stop_reason_sp);
}
+ void
+ CachePlanExplainsStop (bool does_explain)
+ {
+ m_cached_plan_explains_stop = does_explain ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ LazyBool
+ GetCachedPlanExplainsStop () const
+ {
+ return m_cached_plan_explains_stop;
+ }
+
virtual lldb::StateType
GetPlanRunState () = 0;
@@ -551,6 +574,7 @@ private:
ThreadPlanKind m_kind;
std::string m_name;
Mutex m_plan_complete_mutex;
+ LazyBool m_cached_plan_explains_stop;
bool m_plan_complete;
bool m_plan_private;
bool m_okay_to_discard;
diff --git a/lldb/include/lldb/Target/ThreadPlanBase.h b/lldb/include/lldb/Target/ThreadPlanBase.h
index 73c92533a05..226caeab860 100644
--- a/lldb/include/lldb/Target/ThreadPlanBase.h
+++ b/lldb/include/lldb/Target/ThreadPlanBase.h
@@ -35,13 +35,12 @@ public:
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ValidatePlan (Stream *error);
- virtual bool PlanExplainsStop (Event *event_ptr);
virtual bool ShouldStop (Event *event_ptr);
+ virtual Vote ShouldReportStop (Event *event_ptr);
virtual bool StopOthers ();
virtual lldb::StateType GetPlanRunState ();
virtual bool WillStop ();
virtual bool MischiefManaged ();
- virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
virtual bool OkayToDiscard()
{
@@ -55,6 +54,8 @@ public:
}
protected:
+ virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ virtual bool DoPlanExplainsStop (Event *event_ptr);
ThreadPlanBase (Thread &thread);
private:
diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index 4124596fa17..2c1d142a98b 100644
--- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -59,9 +59,6 @@ public:
ValidatePlan (Stream *error);
virtual bool
- PlanExplainsStop (Event *event_ptr);
-
- virtual bool
ShouldStop (Event *event_ptr);
virtual Vote
@@ -135,8 +132,12 @@ public:
virtual bool
RestoreThreadState();
-protected:
+protected:
void ReportRegisterState (const char *message);
+
+ virtual bool
+ DoPlanExplainsStop (Event *event_ptr);
+
private:
bool
diff --git a/lldb/include/lldb/Target/ThreadPlanRunToAddress.h b/lldb/include/lldb/Target/ThreadPlanRunToAddress.h
index 7797456466c..d9482066801 100644
--- a/lldb/include/lldb/Target/ThreadPlanRunToAddress.h
+++ b/lldb/include/lldb/Target/ThreadPlanRunToAddress.h
@@ -47,9 +47,6 @@ public:
ValidatePlan (Stream *error);
virtual bool
- PlanExplainsStop (Event *event_ptr);
-
- virtual bool
ShouldStop (Event *event_ptr);
virtual bool
@@ -68,6 +65,9 @@ public:
MischiefManaged ();
protected:
+ virtual bool
+ DoPlanExplainsStop (Event *event_ptr);
+
void SetInitialBreakpoints();
bool AtOurAddress();
private:
diff --git a/lldb/include/lldb/Target/ThreadPlanStepInRange.h b/lldb/include/lldb/Target/ThreadPlanStepInRange.h
index 1a60e4e094f..f9e64ce2ced 100644
--- a/lldb/include/lldb/Target/ThreadPlanStepInRange.h
+++ b/lldb/include/lldb/Target/ThreadPlanStepInRange.h
@@ -59,13 +59,12 @@ public:
static void
SetDefaultFlagValue (uint32_t new_value);
-
- virtual bool
- PlanExplainsStop (Event *event_ptr);
-
- virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
protected:
+ virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+
+ virtual bool
+ DoPlanExplainsStop (Event *event_ptr);
virtual void
SetFlagsToDefault ();
diff --git a/lldb/include/lldb/Target/ThreadPlanStepInstruction.h b/lldb/include/lldb/Target/ThreadPlanStepInstruction.h
index e4798ba961d..832508d8935 100644
--- a/lldb/include/lldb/Target/ThreadPlanStepInstruction.h
+++ b/lldb/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -27,7 +27,6 @@ public:
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ValidatePlan (Stream *error);
- virtual bool PlanExplainsStop (Event *event_ptr);
virtual bool ShouldStop (Event *event_ptr);
virtual bool StopOthers ();
virtual lldb::StateType GetPlanRunState ();
@@ -35,6 +34,8 @@ public:
virtual bool MischiefManaged ();
protected:
+ virtual bool DoPlanExplainsStop (Event *event_ptr);
+
ThreadPlanStepInstruction (Thread &thread,
bool step_over,
bool stop_others,
diff --git a/lldb/include/lldb/Target/ThreadPlanStepOut.h b/lldb/include/lldb/Target/ThreadPlanStepOut.h
index 9fc6004eda3..9097eff26e2 100644
--- a/lldb/include/lldb/Target/ThreadPlanStepOut.h
+++ b/lldb/include/lldb/Target/ThreadPlanStepOut.h
@@ -34,11 +34,9 @@ public:
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ValidatePlan (Stream *error);
- virtual bool PlanExplainsStop (Event *event_ptr);
virtual bool ShouldStop (Event *event_ptr);
virtual bool StopOthers ();
virtual lldb::StateType GetPlanRunState ();
- virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
virtual bool WillStop ();
virtual bool MischiefManaged ();
virtual void DidPush();
@@ -50,6 +48,8 @@ public:
}
protected:
+ virtual bool DoPlanExplainsStop (Event *event_ptr);
+ virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
bool QueueInlinedStepPlan (bool queue_now);
private:
diff --git a/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
index 1ae113246c8..c1c2a41a4d6 100644
--- a/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
+++ b/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
@@ -27,17 +27,17 @@ public:
ThreadPlanStepOverBreakpoint (Thread &thread);
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ValidatePlan (Stream *error);
- virtual bool PlanExplainsStop (Event *event_ptr);
virtual bool ShouldStop (Event *event_ptr);
virtual bool StopOthers ();
virtual lldb::StateType GetPlanRunState ();
- virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
virtual bool WillStop ();
virtual bool MischiefManaged ();
void SetAutoContinue (bool do_it);
virtual bool ShouldAutoContinue(Event *event_ptr);
protected:
+ virtual bool DoPlanExplainsStop (Event *event_ptr);
+ virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
private:
diff --git a/lldb/include/lldb/Target/ThreadPlanStepOverRange.h b/lldb/include/lldb/Target/ThreadPlanStepOverRange.h
index 762c11648a6..de9e66829dc 100644
--- a/lldb/include/lldb/Target/ThreadPlanStepOverRange.h
+++ b/lldb/include/lldb/Target/ThreadPlanStepOverRange.h
@@ -34,10 +34,10 @@ public:
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ShouldStop (Event *event_ptr);
- virtual bool PlanExplainsStop (Event *event_ptr);
- virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
protected:
+ virtual bool DoPlanExplainsStop (Event *event_ptr);
+ virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
private:
diff --git a/lldb/include/lldb/Target/ThreadPlanStepThrough.h b/lldb/include/lldb/Target/ThreadPlanStepThrough.h
index eacfc897610..08169d1ecf4 100644
--- a/lldb/include/lldb/Target/ThreadPlanStepThrough.h
+++ b/lldb/include/lldb/Target/ThreadPlanStepThrough.h
@@ -26,16 +26,17 @@ public:
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ValidatePlan (Stream *error);
- virtual bool PlanExplainsStop (Event *event_ptr);
virtual bool ShouldStop (Event *event_ptr);
virtual bool StopOthers ();
virtual lldb::StateType GetPlanRunState ();
- virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
virtual bool WillStop ();
virtual bool MischiefManaged ();
virtual void DidPush();
protected:
+ virtual bool DoPlanExplainsStop (Event *event_ptr);
+ virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+
ThreadPlanStepThrough (Thread &thread,
StackID &return_stack_id,
bool stop_others);
diff --git a/lldb/include/lldb/Target/ThreadPlanStepUntil.h b/lldb/include/lldb/Target/ThreadPlanStepUntil.h
index b8e6eda4e4f..e87d24f1b59 100644
--- a/lldb/include/lldb/Target/ThreadPlanStepUntil.h
+++ b/lldb/include/lldb/Target/ThreadPlanStepUntil.h
@@ -27,15 +27,16 @@ public:
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ValidatePlan (Stream *error);
- virtual bool PlanExplainsStop (Event *event_ptr);
virtual bool ShouldStop (Event *event_ptr);
virtual bool StopOthers ();
virtual lldb::StateType GetPlanRunState ();
- virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
virtual bool WillStop ();
virtual bool MischiefManaged ();
protected:
+ virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ virtual bool DoPlanExplainsStop (Event *event_ptr);
+
ThreadPlanStepUntil (Thread &thread,
lldb::addr_t *address_list,
size_t num_addresses,
OpenPOWER on IntegriCloud