1 //===-- ThreadPlanStepThrough.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_THREADPLANSTEPTHROUGH_H
10 #define LLDB_TARGET_THREADPLANSTEPTHROUGH_H
11 
12 #include "lldb/Target/Thread.h"
13 #include "lldb/Target/ThreadPlan.h"
14 
15 namespace lldb_private {
16 
17 class ThreadPlanStepThrough : public ThreadPlan {
18 public:
19   ~ThreadPlanStepThrough() override;
20 
21   void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
22   bool ValidatePlan(Stream *error) override;
23   bool ShouldStop(Event *event_ptr) override;
24   bool StopOthers() override;
25   lldb::StateType GetPlanRunState() override;
26   bool WillStop() override;
27   bool MischiefManaged() override;
28   void DidPush() override;
29 
30 protected:
31   bool DoPlanExplainsStop(Event *event_ptr) override;
32   bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
33 
34   ThreadPlanStepThrough(Thread &thread, StackID &return_stack_id,
35                         bool stop_others);
36 
37   void LookForPlanToStepThroughFromCurrentPC();
38 
39   bool HitOurBackstopBreakpoint();
40 
41 private:
42   friend lldb::ThreadPlanSP
43   Thread::QueueThreadPlanForStepThrough(StackID &return_stack_id,
44                                         bool abort_other_plans,
45                                         bool stop_others, Status &status);
46 
47   void ClearBackstopBreakpoint();
48 
49   lldb::ThreadPlanSP m_sub_plan_sp;
50   lldb::addr_t m_start_address;
51   lldb::break_id_t m_backstop_bkpt_id;
52   lldb::addr_t m_backstop_addr;
53   StackID m_return_stack_id;
54   bool m_stop_others;
55 
56   ThreadPlanStepThrough(const ThreadPlanStepThrough &) = delete;
57   const ThreadPlanStepThrough &
58   operator=(const ThreadPlanStepThrough &) = delete;
59 };
60 
61 } // namespace lldb_private
62 
63 #endif // LLDB_TARGET_THREADPLANSTEPTHROUGH_H
64