Coverage Report

Created: 2023-09-30 09:22

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Target/ThreadPlanStepInRange.h
Line
Count
Source (jump to first uncovered line)
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"
15
#include "lldb/Target/ThreadPlanShouldStopHere.h"
16
#include "lldb/Target/ThreadPlanStepRange.h"
17
18
namespace lldb_private {
19
20
class ThreadPlanStepInRange : public ThreadPlanStepRange,
21
                              public ThreadPlanShouldStopHere {
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.
43
0
  static uint32_t GetDefaultFlagsValue() {
44
0
    return s_default_flag_values;
45
0
  }
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
188
  void SetFlagsToDefault() override {
58
188
    GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
59
188
  }
60
61
188
  void SetCallbacks() {
62
188
    ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks(
63
188
        ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr);
64
188
    SetShouldStopHereCallbacks(&callbacks, nullptr);
65
188
  }
66
67
  bool FrameMatchesAvoidCriteria();
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.
85
  ConstString m_step_into_target;
86
  ThreadPlanStepInRange(const ThreadPlanStepInRange &) = delete;
87
  const ThreadPlanStepInRange &
88
  operator=(const ThreadPlanStepInRange &) = delete;
89
};
90
91
} // namespace lldb_private
92
93
#endif // LLDB_TARGET_THREADPLANSTEPINRANGE_H