1 //===-- ThreadPlanStepOut.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_ThreadPlanStepOut_h_ 11 #define liblldb_ThreadPlanStepOut_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 #include "lldb/Target/ThreadPlanShouldStopHere.h" 20 21 namespace lldb_private { 22 23 class ThreadPlanStepOut : public ThreadPlan, 24 public ThreadPlanShouldStopHere 25 { 26 public: 27 ThreadPlanStepOut (Thread &thread, 28 SymbolContext *addr_context, 29 bool first_insn, 30 bool stop_others, 31 Vote stop_vote, 32 Vote run_vote, 33 uint32_t frame_idx, 34 LazyBool step_out_avoids_code_without_debug_info); 35 36 virtual ~ThreadPlanStepOut (); 37 38 virtual void GetDescription (Stream *s, lldb::DescriptionLevel level); 39 virtual bool ValidatePlan (Stream *error); 40 virtual bool ShouldStop (Event *event_ptr); 41 virtual bool StopOthers (); 42 virtual lldb::StateType GetPlanRunState (); 43 virtual bool WillStop (); 44 virtual bool MischiefManaged (); 45 virtual void DidPush(); 46 virtual bool IsPlanStale(); 47 GetReturnValueObject()48 virtual lldb::ValueObjectSP GetReturnValueObject() 49 { 50 return m_return_valobj_sp; 51 } 52 53 protected: 54 virtual void SetFlagsToDefault()55 SetFlagsToDefault () 56 { 57 GetFlags().Set(ThreadPlanStepOut::s_default_flag_values); 58 } 59 60 virtual bool DoPlanExplainsStop (Event *event_ptr); 61 virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan); 62 bool QueueInlinedStepPlan (bool queue_now); 63 64 private: 65 static uint32_t s_default_flag_values; // These are the default flag values for the ThreadPlanStepThrough. 66 67 lldb::addr_t m_step_from_insn; 68 StackID m_step_out_to_id; 69 StackID m_immediate_step_from_id; 70 lldb::break_id_t m_return_bp_id; 71 lldb::addr_t m_return_addr; 72 bool m_stop_others; 73 lldb::ThreadPlanSP m_step_out_to_inline_plan_sp; // This plan implements step out to the real function containing 74 // an inlined frame so we can then step out of that. 75 lldb::ThreadPlanSP m_step_through_inline_plan_sp; // This plan then steps past the inlined frame(s). 76 lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out if ShouldStopHere told us to. 77 Function *m_immediate_step_from_function; 78 lldb::ValueObjectSP m_return_valobj_sp; 79 80 friend lldb::ThreadPlanSP 81 Thread::QueueThreadPlanForStepOut (bool abort_other_plans, 82 SymbolContext *addr_context, 83 bool first_insn, 84 bool stop_others, 85 Vote stop_vote, 86 Vote run_vote, 87 uint32_t frame_idx, 88 LazyBool step_out_avoids_code_without_debug_info); 89 90 void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info); 91 // Need an appropriate marker for the current stack so we can tell step out 92 // from step in. 93 94 void 95 CalculateReturnValue(); 96 97 DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOut); 98 99 }; 100 101 } // namespace lldb_private 102 103 #endif // liblldb_ThreadPlanStepOut_h_ 104