ThreadPlanStepInRange.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #ifndef LLDB_TARGET_THREADPLANSTEPINRANGE_H
  9. #define LLDB_TARGET_THREADPLANSTEPINRANGE_H
  10. #include "lldb/Core/AddressRange.h"
  11. #include "lldb/Target/StackID.h"
  12. #include "lldb/Target/Thread.h"
  13. #include "lldb/Target/ThreadPlanShouldStopHere.h"
  14. #include "lldb/Target/ThreadPlanStepRange.h"
  15. namespace lldb_private {
  16. class ThreadPlanStepInRange : public ThreadPlanStepRange,
  17. public ThreadPlanShouldStopHere {
  18. public:
  19. ThreadPlanStepInRange(Thread &thread, const AddressRange &range,
  20. const SymbolContext &addr_context,
  21. const char *step_into_target, lldb::RunMode stop_others,
  22. LazyBool step_in_avoids_code_without_debug_info,
  23. LazyBool step_out_avoids_code_without_debug_info);
  24. ~ThreadPlanStepInRange() override;
  25. void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
  26. bool ShouldStop(Event *event_ptr) override;
  27. void SetAvoidRegexp(const char *name);
  28. static void SetDefaultFlagValue(uint32_t new_value);
  29. bool IsVirtualStep() override;
  30. // Plans that are implementing parts of a step in might need to follow the
  31. // behavior of this plan w.r.t. StepThrough. They can get that from here.
  32. static uint32_t GetDefaultFlagsValue() {
  33. return s_default_flag_values;
  34. }
  35. protected:
  36. static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
  37. Flags &flags,
  38. lldb::FrameComparison operation,
  39. Status &status, void *baton);
  40. bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
  41. bool DoPlanExplainsStop(Event *event_ptr) override;
  42. void SetFlagsToDefault() override {
  43. GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
  44. }
  45. void SetCallbacks() {
  46. ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks(
  47. ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr);
  48. SetShouldStopHereCallbacks(&callbacks, nullptr);
  49. }
  50. bool FrameMatchesAvoidCriteria();
  51. private:
  52. void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
  53. LazyBool step_out_avoids_code_without_debug_info);
  54. // Need an appropriate marker for the current stack so we can tell step out
  55. // from step in.
  56. static uint32_t s_default_flag_values; // These are the default flag values
  57. // for the ThreadPlanStepThrough.
  58. lldb::ThreadPlanSP m_sub_plan_sp; // Keep track of the last plan we were
  59. // running. If it fails, we should stop.
  60. std::unique_ptr<RegularExpression> m_avoid_regexp_up;
  61. bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put
  62. // a switch in for this if there's
  63. // demand for that.
  64. bool m_virtual_step; // true if we've just done a "virtual step", i.e. just
  65. // moved the inline stack depth.
  66. ConstString m_step_into_target;
  67. ThreadPlanStepInRange(const ThreadPlanStepInRange &) = delete;
  68. const ThreadPlanStepInRange &
  69. operator=(const ThreadPlanStepInRange &) = delete;
  70. };
  71. } // namespace lldb_private
  72. #endif // LLDB_TARGET_THREADPLANSTEPINRANGE_H