1 //===-- ThreadPlanStepInRange.h ---------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_ThreadPlanStepInRange_h_
10 #define liblldb_ThreadPlanStepInRange_h_
12 #include "lldb/Core/AddressRange.h"
13 #include "lldb/Target/StackID.h"
14 #include "lldb/Target/Thread.h"
15 #include "lldb/Target/ThreadPlanShouldStopHere.h"
16 #include "lldb/Target/ThreadPlanStepRange.h"
18 namespace lldb_private {
20 class ThreadPlanStepInRange : public ThreadPlanStepRange,
21 public ThreadPlanShouldStopHere {
23 ThreadPlanStepInRange(Thread &thread, const AddressRange &range,
24 const SymbolContext &addr_context,
25 lldb::RunMode stop_others,
26 LazyBool step_in_avoids_code_without_debug_info,
27 LazyBool step_out_avoids_code_without_debug_info);
29 ThreadPlanStepInRange(Thread &thread, const AddressRange &range,
30 const SymbolContext &addr_context,
31 const char *step_into_function_name,
32 lldb::RunMode stop_others,
33 LazyBool step_in_avoids_code_without_debug_info,
34 LazyBool step_out_avoids_code_without_debug_info);
36 ~ThreadPlanStepInRange() override;
38 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
40 bool ShouldStop(Event *event_ptr) override;
42 void SetAvoidRegexp(const char *name);
44 void SetStepInTarget(const char *target) {
45 m_step_into_target.SetCString(target);
48 static void SetDefaultFlagValue(uint32_t new_value);
50 bool IsVirtualStep() override;
53 static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
55 lldb::FrameComparison operation,
56 Status &status, void *baton);
58 bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
60 bool DoPlanExplainsStop(Event *event_ptr) override;
62 void SetFlagsToDefault() override {
63 GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
67 ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks(
68 ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr);
69 SetShouldStopHereCallbacks(&callbacks, nullptr);
72 bool FrameMatchesAvoidCriteria();
75 friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
76 bool abort_other_plans, const AddressRange &range,
77 const SymbolContext &addr_context, lldb::RunMode stop_others,
78 Status &status, LazyBool avoid_code_without_debug_info);
79 friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepInRange(
80 bool abort_other_plans, const AddressRange &range,
81 const SymbolContext &addr_context, const char *step_in_target,
82 lldb::RunMode stop_others, Status &status,
83 LazyBool step_in_avoids_code_without_debug_info,
84 LazyBool step_out_avoids_code_without_debug_info);
86 void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
87 LazyBool step_out_avoids_code_without_debug_info);
88 // Need an appropriate marker for the current stack so we can tell step out
91 static uint32_t s_default_flag_values; // These are the default flag values
92 // for the ThreadPlanStepThrough.
93 lldb::ThreadPlanSP m_sub_plan_sp; // Keep track of the last plan we were
94 // running. If it fails, we should stop.
95 std::unique_ptr<RegularExpression> m_avoid_regexp_up;
96 bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put
97 // a switch in for this if there's
99 bool m_virtual_step; // true if we've just done a "virtual step", i.e. just
100 // moved the inline stack depth.
101 ConstString m_step_into_target;
102 DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepInRange);
105 } // namespace lldb_private
107 #endif // liblldb_ThreadPlanStepInRange_h_