LLDB  mainline
ThreadPlanStepInRange.h
Go to the documentation of this file.
1 //===-- ThreadPlanStepInRange.h ---------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TARGET_THREADPLANSTEPINRANGE_H
10 #define LLDB_TARGET_THREADPLANSTEPINRANGE_H
11 
12 #include "lldb/Core/AddressRange.h"
13 #include "lldb/Target/StackID.h"
14 #include "lldb/Target/Thread.h"
17 
18 namespace lldb_private {
19 
22 public:
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);
28 
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);
35 
36  ~ThreadPlanStepInRange() override;
37 
38  void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
39 
40  bool ShouldStop(Event *event_ptr) override;
41 
42  void SetAvoidRegexp(const char *name);
43 
44  void SetStepInTarget(const char *target) {
46  }
47 
48  static void SetDefaultFlagValue(uint32_t new_value);
49 
50  bool IsVirtualStep() override;
51 
52  // Plans that are implementing parts of a step in might need to follow the
53  // behavior of this plan w.r.t. StepThrough. They can get that from here.
55  return s_default_flag_values;
56  }
57 
58 protected:
59  static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
60  Flags &flags,
61  lldb::FrameComparison operation,
62  Status &status, void *baton);
63 
64  bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
65 
66  bool DoPlanExplainsStop(Event *event_ptr) override;
67 
68  void SetFlagsToDefault() override {
70  }
71 
72  void SetCallbacks() {
75  SetShouldStopHereCallbacks(&callbacks, nullptr);
76  }
77 
79 
80 private:
81  friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
82  bool abort_other_plans, const AddressRange &range,
83  const SymbolContext &addr_context, lldb::RunMode stop_others,
84  Status &status, LazyBool avoid_code_without_debug_info);
85  friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepInRange(
86  bool abort_other_plans, const AddressRange &range,
87  const SymbolContext &addr_context, const char *step_in_target,
88  lldb::RunMode stop_others, Status &status,
89  LazyBool step_in_avoids_code_without_debug_info,
90  LazyBool step_out_avoids_code_without_debug_info);
91 
92  void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
93  LazyBool step_out_avoids_code_without_debug_info);
94  // Need an appropriate marker for the current stack so we can tell step out
95  // from step in.
96 
97  static uint32_t s_default_flag_values; // These are the default flag values
98  // for the ThreadPlanStepThrough.
99  lldb::ThreadPlanSP m_sub_plan_sp; // Keep track of the last plan we were
100  // running. If it fails, we should stop.
101  std::unique_ptr<RegularExpression> m_avoid_regexp_up;
102  bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put
103  // a switch in for this if there's
104  // demand for that.
105  bool m_virtual_step; // true if we've just done a "virtual step", i.e. just
106  // moved the inline stack depth.
109  const ThreadPlanStepInRange &
110  operator=(const ThreadPlanStepInRange &) = delete;
111 };
112 
113 } // namespace lldb_private
114 
115 #endif // LLDB_TARGET_THREADPLANSTEPINRANGE_H
void SetShouldStopHereCallbacks(const ThreadPlanShouldStopHereCallbacks *callbacks, void *baton)
static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, Status &status, void *baton)
A class that represents a running process on the host machine.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info)
virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange(bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, const char *step_in_target, lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info=eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queues the plan used to step through an address range, stepping into functions.
Definition: Thread.cpp:1270
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
bool ShouldStop(Event *event_ptr) override
const ThreadPlanStepInRange & operator=(const ThreadPlanStepInRange &)=delete
StateType
Process and Thread States.
ThreadPlanStepInRange(Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info)
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
bool DoPlanExplainsStop(Event *event_ptr) override
FrameComparison
This is the return value for frame comparisons.
ValueType Set(ValueType mask)
Set one or more flags by logical OR&#39;ing mask with the current flags.
Definition: Flags.h:73
A class to manage flags.
Definition: Flags.h:22
void SetStepInTarget(const char *target)
A uniqued constant string class.
Definition: ConstString.h:40
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange(bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queues the plan used to step through an address range, stepping over function calls.
Definition: Thread.cpp:1243
RunMode
Thread Run Modes.
A section + offset based address range class.
Definition: AddressRange.h:25
static void SetDefaultFlagValue(uint32_t new_value)
std::unique_ptr< RegularExpression > m_avoid_regexp_up
An error handling class.
Definition: Status.h:44
void SetCString(const char *cstr)
Set the C string value.