LLDB  mainline
ThreadPlanBase.h
Go to the documentation of this file.
1 //===-- ThreadPlanBase.h ----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TARGET_THREADPLANBASE_H
10 #define LLDB_TARGET_THREADPLANBASE_H
11 
12 #include "lldb/Target/Process.h"
13 #include "lldb/Target/Thread.h"
14 #include "lldb/Target/ThreadPlan.h"
15 
16 namespace lldb_private {
17 
18 // Base thread plans:
19 // This is the generic version of the bottom most plan on the plan stack. It
20 // should
21 // be able to handle generic breakpoint hitting, and signals and exceptions.
22 
23 class ThreadPlanBase : public ThreadPlan {
24  friend class Process; // RunThreadPlan manages "stopper" base plans.
25 public:
26  ~ThreadPlanBase() override;
27 
28  void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
29  bool ValidatePlan(Stream *error) override;
30  bool ShouldStop(Event *event_ptr) override;
31  Vote ShouldReportStop(Event *event_ptr) override;
32  bool StopOthers() override;
34  bool WillStop() override;
35  bool MischiefManaged() override;
36 
37  bool OkayToDiscard() override { return false; }
38 
39  bool IsBasePlan() override { return true; }
40 
41 protected:
42  bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
43  bool DoPlanExplainsStop(Event *event_ptr) override;
44  ThreadPlanBase(Thread &thread);
45 
46 private:
47  friend lldb::ThreadPlanSP Thread::QueueBasePlan(bool abort_other_plans);
48 
49  ThreadPlanBase(const ThreadPlanBase &) = delete;
50  const ThreadPlanBase &operator=(const ThreadPlanBase &) = delete;
51 };
52 
53 } // namespace lldb_private
54 
55 #endif // LLDB_TARGET_THREADPLANBASE_H
lldb_private::ThreadPlanBase::IsBasePlan
bool IsBasePlan() override
Definition: ThreadPlanBase.h:39
lldb_private::ThreadPlanBase::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
Definition: ThreadPlanBase.cpp:48
lldb_private::ThreadPlanBase::DoPlanExplainsStop
bool DoPlanExplainsStop(Event *event_ptr) override
Definition: ThreadPlanBase.cpp:54
lldb_private::Event
Definition: Event.h:180
lldb_private::ThreadPlanBase::WillStop
bool WillStop() override
Definition: ThreadPlanBase.cpp:182
lldb_private::Process
Definition: Process.h:341
lldb_private::ThreadPlanBase::ThreadPlanBase
ThreadPlanBase(Thread &thread)
Definition: ThreadPlanBase.cpp:29
lldb_private::ThreadPlanBase::DoWillResume
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
Definition: ThreadPlanBase.cpp:184
lldb_private::Stream
Definition: Stream.h:28
Process.h
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ThreadPlanBase::MischiefManaged
bool MischiefManaged() override
Definition: ThreadPlanBase.cpp:194
lldb_private::ThreadPlanBase::OkayToDiscard
bool OkayToDiscard() override
Definition: ThreadPlanBase.h:37
lldb_private::ThreadPlan
Definition: ThreadPlan.h:282
lldb_private::ThreadPlanBase::~ThreadPlanBase
~ThreadPlanBase() override
lldb_private::Thread
Definition: Thread.h:60
lldb_private::ThreadPlanBase
Definition: ThreadPlanBase.h:23
Thread.h
lldb_private::Thread::QueueBasePlan
lldb::ThreadPlanSP QueueBasePlan(bool abort_other_plans)
Queues the base plan for a thread.
Definition: Thread.cpp:1231
ThreadPlan.h
lldb_private::ThreadPlanBase::ValidatePlan
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
Definition: ThreadPlanBase.cpp:52
lldb_private::ThreadPlanBase::ShouldStop
bool ShouldStop(Event *event_ptr) override
Definition: ThreadPlanBase.cpp:72
lldb_private::Vote
Vote
Definition: lldb-private-enumerations.h:59
lldb_private::ThreadPlanBase::operator=
const ThreadPlanBase & operator=(const ThreadPlanBase &)=delete
lldb_private::ThreadPlanBase::ShouldReportStop
Vote ShouldReportStop(Event *event_ptr) override
Definition: ThreadPlanBase.cpp:60
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ThreadPlanBase::StopOthers
bool StopOthers() override
Definition: ThreadPlanBase.cpp:178
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::ThreadPlanBase::GetPlanRunState
lldb::StateType GetPlanRunState() override
Definition: ThreadPlanBase.cpp:180
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207