Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:56

0001 //===-- ThreadPlanStepOut.h -------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_TARGET_THREADPLANSTEPOUT_H
0010 #define LLDB_TARGET_THREADPLANSTEPOUT_H
0011 
0012 #include "lldb/Target/Thread.h"
0013 #include "lldb/Target/ThreadPlan.h"
0014 #include "lldb/Target/ThreadPlanShouldStopHere.h"
0015 
0016 namespace lldb_private {
0017 
0018 class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
0019 public:
0020   ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context,
0021                     bool first_insn, bool stop_others, Vote report_stop_vote,
0022                     Vote report_run_vote, uint32_t frame_idx,
0023                     LazyBool step_out_avoids_code_without_debug_info,
0024                     bool continue_to_next_branch = false,
0025                     bool gather_return_value = true);
0026 
0027   ~ThreadPlanStepOut() override;
0028 
0029   void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
0030   bool ValidatePlan(Stream *error) override;
0031   bool ShouldStop(Event *event_ptr) override;
0032   bool StopOthers() override;
0033   void SetStopOthers(bool new_value) override { m_stop_others = new_value; }
0034   lldb::StateType GetPlanRunState() override;
0035   bool WillStop() override;
0036   bool MischiefManaged() override;
0037   void DidPush() override;
0038   bool IsPlanStale() override;
0039 
0040   lldb::ValueObjectSP GetReturnValueObject() override {
0041     return m_return_valobj_sp;
0042   }
0043 
0044 protected:
0045   void SetFlagsToDefault() override {
0046     GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
0047   }
0048 
0049   bool DoPlanExplainsStop(Event *event_ptr) override;
0050   bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
0051   bool QueueInlinedStepPlan(bool queue_now);
0052 
0053 private:
0054   static uint32_t s_default_flag_values; // These are the default flag values
0055                                          // for the ThreadPlanStepThrough.
0056 
0057   lldb::addr_t m_step_from_insn;
0058   StackID m_step_out_to_id;
0059   StackID m_immediate_step_from_id;
0060   lldb::break_id_t m_return_bp_id;
0061   lldb::addr_t m_return_addr;
0062   bool m_stop_others;
0063   lldb::ThreadPlanSP m_step_out_to_inline_plan_sp; // This plan implements step
0064                                                    // out to the real function
0065                                                    // containing
0066   // an inlined frame so we can then step out of that.
0067   lldb::ThreadPlanSP m_step_through_inline_plan_sp; // This plan then steps past
0068                                                     // the inlined frame(s).
0069   lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out
0070                                                  // if ShouldStopHere told us
0071                                                  // to.
0072   Function *m_immediate_step_from_function;
0073   std::vector<lldb::StackFrameSP> m_stepped_past_frames;
0074   lldb::ValueObjectSP m_return_valobj_sp;
0075   bool m_calculate_return_value;
0076   StreamString m_constructor_errors;
0077 
0078   friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut(
0079       bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
0080       bool stop_others, Vote report_stop_vote, Vote report_run_vote,
0081       uint32_t frame_idx, Status &status,
0082       LazyBool step_out_avoids_code_without_debug_info);
0083 
0084   void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
0085   // Need an appropriate marker for the current stack so we can tell step out
0086   // from step in.
0087 
0088   void CalculateReturnValue();
0089 
0090   ThreadPlanStepOut(const ThreadPlanStepOut &) = delete;
0091   const ThreadPlanStepOut &operator=(const ThreadPlanStepOut &) = delete;
0092 };
0093 
0094 } // namespace lldb_private
0095 
0096 #endif // LLDB_TARGET_THREADPLANSTEPOUT_H