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