ThreadPlanStepOut.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //===-- ThreadPlanStepOut.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_THREADPLANSTEPOUT_H
  9. #define LLDB_TARGET_THREADPLANSTEPOUT_H
  10. #include "lldb/Target/Thread.h"
  11. #include "lldb/Target/ThreadPlan.h"
  12. #include "lldb/Target/ThreadPlanShouldStopHere.h"
  13. namespace lldb_private {
  14. class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
  15. public:
  16. ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context,
  17. bool first_insn, bool stop_others, Vote report_stop_vote,
  18. Vote report_run_vote, uint32_t frame_idx,
  19. LazyBool step_out_avoids_code_without_debug_info,
  20. bool continue_to_next_branch = false,
  21. bool gather_return_value = true);
  22. ~ThreadPlanStepOut() override;
  23. void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
  24. bool ValidatePlan(Stream *error) override;
  25. bool ShouldStop(Event *event_ptr) override;
  26. bool StopOthers() override;
  27. lldb::StateType GetPlanRunState() override;
  28. bool WillStop() override;
  29. bool MischiefManaged() override;
  30. void DidPush() override;
  31. bool IsPlanStale() override;
  32. lldb::ValueObjectSP GetReturnValueObject() override {
  33. return m_return_valobj_sp;
  34. }
  35. protected:
  36. void SetFlagsToDefault() override {
  37. GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
  38. }
  39. bool DoPlanExplainsStop(Event *event_ptr) override;
  40. bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
  41. bool QueueInlinedStepPlan(bool queue_now);
  42. private:
  43. static uint32_t s_default_flag_values; // These are the default flag values
  44. // for the ThreadPlanStepThrough.
  45. lldb::addr_t m_step_from_insn;
  46. StackID m_step_out_to_id;
  47. StackID m_immediate_step_from_id;
  48. lldb::break_id_t m_return_bp_id;
  49. lldb::addr_t m_return_addr;
  50. bool m_stop_others;
  51. lldb::ThreadPlanSP m_step_out_to_inline_plan_sp; // This plan implements step
  52. // out to the real function
  53. // containing
  54. // an inlined frame so we can then step out of that.
  55. lldb::ThreadPlanSP m_step_through_inline_plan_sp; // This plan then steps past
  56. // the inlined frame(s).
  57. lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out
  58. // if ShouldStopHere told us
  59. // to.
  60. Function *m_immediate_step_from_function;
  61. std::vector<lldb::StackFrameSP> m_stepped_past_frames;
  62. lldb::ValueObjectSP m_return_valobj_sp;
  63. bool m_calculate_return_value;
  64. StreamString m_constructor_errors;
  65. friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut(
  66. bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
  67. bool stop_others, Vote report_stop_vote, Vote report_run_vote,
  68. uint32_t frame_idx, Status &status,
  69. LazyBool step_out_avoids_code_without_debug_info);
  70. void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
  71. // Need an appropriate marker for the current stack so we can tell step out
  72. // from step in.
  73. void CalculateReturnValue();
  74. ThreadPlanStepOut(const ThreadPlanStepOut &) = delete;
  75. const ThreadPlanStepOut &operator=(const ThreadPlanStepOut &) = delete;
  76. };
  77. } // namespace lldb_private
  78. #endif // LLDB_TARGET_THREADPLANSTEPOUT_H