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