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 liblldb_ThreadPlanStepInRange_h_
10 #define liblldb_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) {
45  m_step_into_target.SetCString(target);
46  }
47 
48  static void SetDefaultFlagValue(uint32_t new_value);
49 
50  bool IsVirtualStep() override;
51 
52 protected:
53  static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
54  Flags &flags,
55  lldb::FrameComparison operation,
56  Status &status, void *baton);
57 
58  bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
59 
60  bool DoPlanExplainsStop(Event *event_ptr) override;
61 
62  void SetFlagsToDefault() override {
63  GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
64  }
65 
66  void SetCallbacks() {
69  SetShouldStopHereCallbacks(&callbacks, nullptr);
70  }
71 
73 
74 private:
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);
85 
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
89  // from step in.
90 
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
98  // demand for that.
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);
103 };
104 
105 } // namespace lldb_private
106 
107 #endif // liblldb_ThreadPlanStepInRange_h_
void SetShouldStopHereCallbacks(const ThreadPlanShouldStopHereCallbacks *callbacks, void *baton)
static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, Status &status, void *baton)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
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
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:1406
bool ShouldStop(Event *event_ptr) override
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
ValueType Set(ValueType mask)
Set one or more flags by logical OR&#39;ing mask with the current flags.
Definition: Flags.h:84
A class to manage flags.
Definition: Flags.h:22
void SetStepInTarget(const char *target)
A uniqued constant string class.
Definition: ConstString.h:38
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:1379
A section + offset based address range class.
Definition: AddressRange.h:32
static void SetDefaultFlagValue(uint32_t new_value)
An error handling class.
Definition: Status.h:44
void SetCString(const char *cstr)
Set the C string value.