1 //===-- ThreadPlanStepInRange.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_ThreadPlanStepInRange_h_
11 #define liblldb_ThreadPlanStepInRange_h_
15 // Other libraries and framework 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"
23 namespace lldb_private {
25 class ThreadPlanStepInRange : public ThreadPlanStepRange,
26 public ThreadPlanShouldStopHere {
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);
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);
41 ~ThreadPlanStepInRange() override;
43 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
45 bool ShouldStop(Event *event_ptr) override;
47 void SetAvoidRegexp(const char *name);
49 void SetStepInTarget(const char *target) {
50 m_step_into_target.SetCString(target);
53 static void SetDefaultFlagValue(uint32_t new_value);
55 bool IsVirtualStep() override;
58 static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
60 lldb::FrameComparison operation,
63 bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
65 bool DoPlanExplainsStop(Event *event_ptr) override;
67 void SetFlagsToDefault() override {
68 GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
72 ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks(
73 ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr);
74 SetShouldStopHereCallbacks(&callbacks, nullptr);
77 bool FrameMatchesAvoidCriteria();
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);
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
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
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);
110 } // namespace lldb_private
112 #endif // liblldb_ThreadPlanStepInRange_h_