1 //===-- ThreadPlanBase.h ----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_ThreadPlanFundamental_h_
11 #define liblldb_ThreadPlanFundamental_h_
12 
13 #include "lldb/Target/Process.h"
14 #include "lldb/Target/Thread.h"
15 #include "lldb/Target/ThreadPlan.h"
16 
17 namespace lldb_private {
18 
19 //------------------------------------------------------------------
20 //  Base thread plans:
21 //  This is the generic version of the bottom most plan on the plan stack.  It
22 //  should
23 //  be able to handle generic breakpoint hitting, and signals and exceptions.
24 //------------------------------------------------------------------
25 
26 class ThreadPlanBase : public ThreadPlan {
27   friend class Process; // RunThreadPlan manages "stopper" base plans.
28 public:
29   ~ThreadPlanBase() override;
30 
31   void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
32   bool ValidatePlan(Stream *error) override;
33   bool ShouldStop(Event *event_ptr) override;
34   Vote ShouldReportStop(Event *event_ptr) override;
35   bool StopOthers() override;
36   lldb::StateType GetPlanRunState() override;
37   bool WillStop() override;
38   bool MischiefManaged() override;
39 
OkayToDiscard()40   bool OkayToDiscard() override { return false; }
41 
IsBasePlan()42   bool IsBasePlan() override { return true; }
43 
44 protected:
45   bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
46   bool DoPlanExplainsStop(Event *event_ptr) override;
47   ThreadPlanBase(Thread &thread);
48 
49 private:
50   friend lldb::ThreadPlanSP
51   Thread::QueueFundamentalPlan(bool abort_other_plans);
52 
53   DISALLOW_COPY_AND_ASSIGN(ThreadPlanBase);
54 };
55 
56 } // namespace lldb_private
57 
58 #endif // liblldb_ThreadPlanFundamental_h_
59