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