1 //===-- ThreadPlanStepUntil.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_ThreadPlanStepUntil_h_
11 #define liblldb_ThreadPlanStepUntil_h_
12 
13 #include "lldb/Target/Thread.h"
14 #include "lldb/Target/ThreadPlan.h"
15 
16 namespace lldb_private {
17 
18 class ThreadPlanStepUntil : public ThreadPlan {
19 public:
20   ~ThreadPlanStepUntil() override;
21 
22   void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
23   bool ValidatePlan(Stream *error) override;
24   bool ShouldStop(Event *event_ptr) override;
25   bool StopOthers() override;
26   lldb::StateType GetPlanRunState() override;
27   bool WillStop() override;
28   bool MischiefManaged() override;
29 
30 protected:
31   bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
32   bool DoPlanExplainsStop(Event *event_ptr) override;
33 
34   ThreadPlanStepUntil(Thread &thread, lldb::addr_t *address_list,
35                       size_t num_addresses, bool stop_others,
36                       uint32_t frame_idx = 0);
37 
38   void AnalyzeStop();
39 
40 private:
41   StackID m_stack_id;
42   lldb::addr_t m_step_from_insn;
43   lldb::break_id_t m_return_bp_id;
44   lldb::addr_t m_return_addr;
45   bool m_stepped_out;
46   bool m_should_stop;
47   bool m_ran_analyze;
48   bool m_explains_stop;
49 
50   typedef std::map<lldb::addr_t, lldb::break_id_t> until_collection;
51   until_collection m_until_points;
52   bool m_stop_others;
53 
54   void Clear();
55 
56   friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepUntil(
57       bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses,
58       bool stop_others, uint32_t frame_idx, Status &status);
59 
60   // Need an appropriate marker for the current stack so we can tell step out
61   // from step in.
62 
63   DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepUntil);
64 };
65 
66 } // namespace lldb_private
67 
68 #endif // liblldb_ThreadPlanStepUntil_h_
69