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  const char *step_into_target, 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() override;
30 
31  void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
32 
33  bool ShouldStop(Event *event_ptr) override;
34 
35  void SetAvoidRegexp(const char *name);
36 
37  static void SetDefaultFlagValue(uint32_t new_value);
38 
39  bool IsVirtualStep() override;
40 
41  // Plans that are implementing parts of a step in might need to follow the
42  // behavior of this plan w.r.t. StepThrough. They can get that from here.
44  return s_default_flag_values;
45  }
46 
47 protected:
48  static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
49  Flags &flags,
50  lldb::FrameComparison operation,
51  Status &status, void *baton);
52 
53  bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
54 
55  bool DoPlanExplainsStop(Event *event_ptr) override;
56 
57  void SetFlagsToDefault() override {
59  }
60 
61  void SetCallbacks() {
64  SetShouldStopHereCallbacks(&callbacks, nullptr);
65  }
66 
68 
69 private:
70  void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
71  LazyBool step_out_avoids_code_without_debug_info);
72  // Need an appropriate marker for the current stack so we can tell step out
73  // from step in.
74 
75  static uint32_t s_default_flag_values; // These are the default flag values
76  // for the ThreadPlanStepThrough.
77  lldb::ThreadPlanSP m_sub_plan_sp; // Keep track of the last plan we were
78  // running. If it fails, we should stop.
79  std::unique_ptr<RegularExpression> m_avoid_regexp_up;
80  bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put
81  // a switch in for this if there's
82  // demand for that.
83  bool m_virtual_step; // true if we've just done a "virtual step", i.e. just
84  // moved the inline stack depth.
87  const ThreadPlanStepInRange &
88  operator=(const ThreadPlanStepInRange &) = delete;
89 };
90 
91 } // namespace lldb_private
92 
93 #endif // LLDB_TARGET_THREADPLANSTEPINRANGE_H
lldb_private::ThreadPlanStepInRange::operator=
const ThreadPlanStepInRange & operator=(const ThreadPlanStepInRange &)=delete
lldb_private::ThreadPlanStepInRange::~ThreadPlanStepInRange
~ThreadPlanStepInRange() override
lldb_private::ThreadPlanStepInRange::DoWillResume
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
Definition: ThreadPlanStepInRange.cpp:463
lldb::FrameComparison
FrameComparison
This is the return value for frame comparisons.
Definition: lldb-enumerations.h:860
lldb_private::ThreadPlanStepInRange::SetAvoidRegexp
void SetAvoidRegexp(const char *name)
Definition: ThreadPlanStepInRange.cpp:293
lldb_private::Event
Definition: Event.h:180
lldb_private::ThreadPlanStepInRange::ThreadPlanStepInRange
ThreadPlanStepInRange(Thread &thread, const AddressRange &range, const SymbolContext &addr_context, const char *step_into_target, lldb::RunMode stop_others, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info)
Definition: ThreadPlanStepInRange.cpp:34
lldb_private::Flags
Definition: Flags.h:22
lldb_private::ThreadPlanStepRange
Definition: ThreadPlanStepRange.h:20
lldb_private::Stream
Definition: Stream.h:28
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb_private::ThreadPlanStepInRange::DoPlanExplainsStop
bool DoPlanExplainsStop(Event *event_ptr) override
Definition: ThreadPlanStepInRange.cpp:418
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::ThreadPlanStepInRange::m_step_past_prologue
bool m_step_past_prologue
Definition: ThreadPlanStepInRange.h:80
lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria
bool FrameMatchesAvoidCriteria()
Definition: ThreadPlanStepInRange.cpp:305
lldb_private::ThreadPlan
Definition: ThreadPlan.h:282
ThreadPlanStepRange.h
lldb_private::ThreadPlanStepInRange::m_sub_plan_sp
lldb::ThreadPlanSP m_sub_plan_sp
Definition: ThreadPlanStepInRange.h:77
lldb_private::ThreadPlanStepInRange::SetDefaultFlagValue
static void SetDefaultFlagValue(uint32_t new_value)
Definition: ThreadPlanStepInRange.cpp:300
lldb_private::Thread
Definition: Thread.h:60
lldb_private::ThreadPlanStepInRange::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
Definition: ThreadPlanStepInRange.cpp:90
lldb_private::ThreadPlanStepInRange::m_virtual_step
bool m_virtual_step
Definition: ThreadPlanStepInRange.h:83
lldb_private::ConstString
Definition: ConstString.h:40
StackID.h
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::ThreadPlanShouldStopHere
Definition: ThreadPlanShouldStopHere.h:34
Thread.h
lldb_private::ThreadPlanShouldStopHere::GetFlags
lldb_private::Flags & GetFlags()
Definition: ThreadPlanShouldStopHere.h:104
lldb::RunMode
RunMode
Thread Run Modes.
Definition: lldb-enumerations.h:135
lldb_private::ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks
Definition: ThreadPlanShouldStopHere.h:36
lldb_private::ThreadPlanStepInRange::s_default_flag_values
static uint32_t s_default_flag_values
Definition: ThreadPlanStepInRange.h:75
lldb_private::ThreadPlanStepInRange::SetupAvoidNoDebug
void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info)
Definition: ThreadPlanStepInRange.cpp:52
lldb_private::Status
Definition: Status.h:44
lldb_private::ThreadPlanStepInRange::m_avoid_regexp_up
std::unique_ptr< RegularExpression > m_avoid_regexp_up
Definition: ThreadPlanStepInRange.h:79
lldb_private::ThreadPlanStepInRange::m_step_into_target
ConstString m_step_into_target
Definition: ThreadPlanStepInRange.h:85
uint32_t
lldb_private::ThreadPlanStepInRange::DefaultShouldStopHereCallback
static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, Status &status, void *baton)
Definition: ThreadPlanStepInRange.cpp:361
lldb_private::ThreadPlanStepInRange::SetCallbacks
void SetCallbacks()
Definition: ThreadPlanStepInRange.h:61
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ThreadPlanShouldStopHere::SetShouldStopHereCallbacks
void SetShouldStopHereCallbacks(const ThreadPlanShouldStopHereCallbacks *callbacks, void *baton)
Definition: ThreadPlanShouldStopHere.h:79
lldb_private::ThreadPlanStepInRange::GetDefaultFlagsValue
static uint32_t GetDefaultFlagsValue()
Definition: ThreadPlanStepInRange.h:43
lldb_private::Flags::Set
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Definition: Flags.h:73
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::ThreadPlanStepInRange::IsVirtualStep
bool IsVirtualStep() override
Definition: ThreadPlanStepInRange.cpp:488
lldb_private::ThreadPlanStepInRange::ShouldStop
bool ShouldStop(Event *event_ptr) override
Definition: ThreadPlanStepInRange.cpp:127
AddressRange.h
lldb_private::ThreadPlanStepInRange
Definition: ThreadPlanStepInRange.h:20
lldb_private::ThreadPlanStepInRange::SetFlagsToDefault
void SetFlagsToDefault() override
Definition: ThreadPlanStepInRange.h:57
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
ThreadPlanShouldStopHere.h