1 //===-- ThreadPlanStepInRange.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_ThreadPlanStepInRange_h_ 11 #define liblldb_ThreadPlanStepInRange_h_ 12 13 #include "lldb/Core/AddressRange.h" 14 #include "lldb/Target/StackID.h" 15 #include "lldb/Target/Thread.h" 16 #include "lldb/Target/ThreadPlanShouldStopHere.h" 17 #include "lldb/Target/ThreadPlanStepRange.h" 18 19 namespace lldb_private { 20 21 class ThreadPlanStepInRange : public ThreadPlanStepRange, 22 public ThreadPlanShouldStopHere { 23 public: 24 ThreadPlanStepInRange(Thread &thread, const AddressRange &range, 25 const SymbolContext &addr_context, 26 lldb::RunMode stop_others, 27 LazyBool step_in_avoids_code_without_debug_info, 28 LazyBool step_out_avoids_code_without_debug_info); 29 30 ThreadPlanStepInRange(Thread &thread, const AddressRange &range, 31 const SymbolContext &addr_context, 32 const char *step_into_function_name, 33 lldb::RunMode stop_others, 34 LazyBool step_in_avoids_code_without_debug_info, 35 LazyBool step_out_avoids_code_without_debug_info); 36 37 ~ThreadPlanStepInRange() override; 38 39 void GetDescription(Stream *s, lldb::DescriptionLevel level) override; 40 41 bool ShouldStop(Event *event_ptr) override; 42 43 void SetAvoidRegexp(const char *name); 44 SetStepInTarget(const char * target)45 void SetStepInTarget(const char *target) { 46 m_step_into_target.SetCString(target); 47 } 48 49 static void SetDefaultFlagValue(uint32_t new_value); 50 51 bool IsVirtualStep() override; 52 53 protected: 54 static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan, 55 Flags &flags, 56 lldb::FrameComparison operation, 57 Status &status, void *baton); 58 59 bool DoWillResume(lldb::StateType resume_state, bool current_plan) override; 60 61 bool DoPlanExplainsStop(Event *event_ptr) override; 62 SetFlagsToDefault()63 void SetFlagsToDefault() override { 64 GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values); 65 } 66 SetCallbacks()67 void SetCallbacks() { 68 ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks( 69 ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr); 70 SetShouldStopHereCallbacks(&callbacks, nullptr); 71 } 72 73 bool FrameMatchesAvoidCriteria(); 74 75 private: 76 friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOverRange( 77 bool abort_other_plans, const AddressRange &range, 78 const SymbolContext &addr_context, lldb::RunMode stop_others, 79 Status &status, LazyBool avoid_code_without_debug_info); 80 friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepInRange( 81 bool abort_other_plans, const AddressRange &range, 82 const SymbolContext &addr_context, const char *step_in_target, 83 lldb::RunMode stop_others, Status &status, 84 LazyBool step_in_avoids_code_without_debug_info, 85 LazyBool step_out_avoids_code_without_debug_info); 86 87 void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info, 88 LazyBool step_out_avoids_code_without_debug_info); 89 // Need an appropriate marker for the current stack so we can tell step out 90 // from step in. 91 92 static uint32_t s_default_flag_values; // These are the default flag values 93 // for the ThreadPlanStepThrough. 94 lldb::ThreadPlanSP m_sub_plan_sp; // Keep track of the last plan we were 95 // running. If it fails, we should stop. 96 std::unique_ptr<RegularExpression> m_avoid_regexp_ap; 97 bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put 98 // a switch in for this if there's 99 // demand for that. 100 bool m_virtual_step; // true if we've just done a "virtual step", i.e. just 101 // moved the inline stack depth. 102 ConstString m_step_into_target; 103 DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepInRange); 104 }; 105 106 } // namespace lldb_private 107 108 #endif // liblldb_ThreadPlanStepInRange_h_ 109