1 //===-- ThreadPlanStepOut.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ThreadPlanStepOut_h_
11 #define liblldb_ThreadPlanStepOut_h_
15 // Other libraries and framework includes
17 #include "lldb/Target/Thread.h"
18 #include "lldb/Target/ThreadPlan.h"
19 #include "lldb/Target/ThreadPlanShouldStopHere.h"
21 namespace lldb_private {
23 class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
25 ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context,
26 bool first_insn, bool stop_others, Vote stop_vote,
27 Vote run_vote, uint32_t frame_idx,
28 LazyBool step_out_avoids_code_without_debug_info,
29 bool continue_to_next_branch = false,
30 bool gather_return_value = true);
32 ~ThreadPlanStepOut() override;
34 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
35 bool ValidatePlan(Stream *error) override;
36 bool ShouldStop(Event *event_ptr) override;
37 bool StopOthers() override;
38 lldb::StateType GetPlanRunState() override;
39 bool WillStop() override;
40 bool MischiefManaged() override;
41 void DidPush() override;
42 bool IsPlanStale() override;
44 lldb::ValueObjectSP GetReturnValueObject() override {
45 return m_return_valobj_sp;
49 void SetFlagsToDefault() override {
50 GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
53 bool DoPlanExplainsStop(Event *event_ptr) override;
54 bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
55 bool QueueInlinedStepPlan(bool queue_now);
58 static uint32_t s_default_flag_values; // These are the default flag values
59 // for the ThreadPlanStepThrough.
61 lldb::addr_t m_step_from_insn;
62 StackID m_step_out_to_id;
63 StackID m_immediate_step_from_id;
64 lldb::break_id_t m_return_bp_id;
65 lldb::addr_t m_return_addr;
67 lldb::ThreadPlanSP m_step_out_to_inline_plan_sp; // This plan implements step
68 // out to the real function
70 // an inlined frame so we can then step out of that.
71 lldb::ThreadPlanSP m_step_through_inline_plan_sp; // This plan then steps past
72 // the inlined frame(s).
73 lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out
74 // if ShouldStopHere told us
76 Function *m_immediate_step_from_function;
77 lldb::ValueObjectSP m_return_valobj_sp;
78 bool m_calculate_return_value;
80 friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut(
81 bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
82 bool stop_others, Vote stop_vote, Vote run_vote, uint32_t frame_idx,
83 LazyBool step_out_avoids_code_without_debug_info);
85 void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
86 // Need an appropriate marker for the current stack so we can tell step out
89 void CalculateReturnValue();
91 DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOut);
94 } // namespace lldb_private
96 #endif // liblldb_ThreadPlanStepOut_h_