LLDB  mainline
ThreadPlanStepOut.h
Go to the documentation of this file.
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 
9 #ifndef LLDB_TARGET_THREADPLANSTEPOUT_H
10 #define LLDB_TARGET_THREADPLANSTEPOUT_H
11 
12 #include "lldb/Target/Thread.h"
13 #include "lldb/Target/ThreadPlan.h"
15 
16 namespace lldb_private {
17 
19 public:
20  ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context,
21  bool first_insn, bool stop_others, Vote report_stop_vote,
22  Vote report_run_vote, uint32_t frame_idx,
23  LazyBool step_out_avoids_code_without_debug_info,
24  bool continue_to_next_branch = false,
25  bool gather_return_value = true);
26 
27  ~ThreadPlanStepOut() override;
28 
29  void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
30  bool ValidatePlan(Stream *error) override;
31  bool ShouldStop(Event *event_ptr) override;
32  bool StopOthers() override;
34  bool WillStop() override;
35  bool MischiefManaged() override;
36  void DidPush() override;
37  bool IsPlanStale() override;
38 
39  lldb::ValueObjectSP GetReturnValueObject() override {
40  return m_return_valobj_sp;
41  }
42 
43 protected:
44  void SetFlagsToDefault() override {
46  }
47 
48  bool DoPlanExplainsStop(Event *event_ptr) override;
49  bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
50  bool QueueInlinedStepPlan(bool queue_now);
51 
52 private:
53  static uint32_t s_default_flag_values; // These are the default flag values
54  // for the ThreadPlanStepThrough.
55 
62  lldb::ThreadPlanSP m_step_out_to_inline_plan_sp; // This plan implements step
63  // out to the real function
64  // containing
65  // an inlined frame so we can then step out of that.
66  lldb::ThreadPlanSP m_step_through_inline_plan_sp; // This plan then steps past
67  // the inlined frame(s).
68  lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out
69  // if ShouldStopHere told us
70  // to.
72  std::vector<lldb::StackFrameSP> m_stepped_past_frames;
73  lldb::ValueObjectSP m_return_valobj_sp;
76 
77  friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut(
78  bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
79  bool stop_others, Vote report_stop_vote, Vote report_run_vote,
80  uint32_t frame_idx, Status &status,
81  LazyBool step_out_avoids_code_without_debug_info);
82 
83  void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
84  // Need an appropriate marker for the current stack so we can tell step out
85  // from step in.
86 
87  void CalculateReturnValue();
88 
89  ThreadPlanStepOut(const ThreadPlanStepOut &) = delete;
90  const ThreadPlanStepOut &operator=(const ThreadPlanStepOut &) = delete;
91 };
92 
93 } // namespace lldb_private
94 
95 #endif // LLDB_TARGET_THREADPLANSTEPOUT_H
lldb_private::ThreadPlanStepOut::ValidatePlan
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
Definition: ThreadPlanStepOut.cpp:240
lldb_private::ThreadPlanStepOut::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
Definition: ThreadPlanStepOut.cpp:194
lldb_private::Event
Definition: Event.h:180
lldb_private::ThreadPlanStepOut::WillStop
bool WillStop() override
Definition: ThreadPlanStepOut.cpp:407
lldb_private::ThreadPlanStepOut::m_step_through_inline_plan_sp
lldb::ThreadPlanSP m_step_through_inline_plan_sp
Definition: ThreadPlanStepOut.h:66
lldb_private::ThreadPlanStepOut::SetupAvoidNoDebug
void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info)
Definition: ThreadPlanStepOut.cpp:161
lldb_private::ThreadPlanStepOut::m_return_bp_id
lldb::break_id_t m_return_bp_id
Definition: ThreadPlanStepOut.h:59
lldb_private::ThreadPlanStepOut::m_return_addr
lldb::addr_t m_return_addr
Definition: ThreadPlanStepOut.h:60
lldb_private::ThreadPlanStepOut::m_immediate_step_from_id
StackID m_immediate_step_from_id
Definition: ThreadPlanStepOut.h:58
lldb_private::ThreadPlanStepOut::m_calculate_return_value
bool m_calculate_return_value
Definition: ThreadPlanStepOut.h:74
lldb_private::Thread::QueueThreadPlanForStepOut
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut(bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, Status &status, LazyBool step_out_avoids_code_without_debug_info=eLazyBoolCalculate)
Queue the plan used to step out of the function at the current PC of thread.
Definition: Thread.cpp:1303
lldb_private::ThreadPlanStepOut
Definition: ThreadPlanStepOut.h:18
lldb_private::ThreadPlanStepOut::m_constructor_errors
StreamString m_constructor_errors
Definition: ThreadPlanStepOut.h:75
lldb_private::Stream
Definition: Stream.h:28
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::ThreadPlanStepOut::MischiefManaged
bool MischiefManaged() override
Definition: ThreadPlanStepOut.cpp:417
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::ThreadPlanStepOut::ShouldStop
bool ShouldStop(Event *event_ptr) override
Definition: ThreadPlanStepOut.cpp:336
lldb_private::ThreadPlanStepOut::QueueInlinedStepPlan
bool QueueInlinedStepPlan(bool queue_now)
Definition: ThreadPlanStepOut.cpp:441
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::Function
Definition: Function.h:413
lldb_private::ThreadPlan
Definition: ThreadPlan.h:282
lldb_private::Thread
Definition: Thread.h:60
lldb::break_id_t
int32_t break_id_t
Definition: lldb-types.h:88
lldb_private::ThreadPlanStepOut::m_step_out_to_id
StackID m_step_out_to_id
Definition: ThreadPlanStepOut.h:57
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::ThreadPlanStepOut::m_step_from_insn
lldb::addr_t m_step_from_insn
Definition: ThreadPlanStepOut.h:56
lldb_private::ThreadPlanStepOut::IsPlanStale
bool IsPlanStale() override
Definition: ThreadPlanStepOut.cpp:522
lldb_private::ThreadPlanShouldStopHere
Definition: ThreadPlanShouldStopHere.h:34
Thread.h
lldb_private::ThreadPlanShouldStopHere::GetFlags
lldb_private::Flags & GetFlags()
Definition: ThreadPlanShouldStopHere.h:104
lldb_private::ThreadPlanStepOut::operator=
const ThreadPlanStepOut & operator=(const ThreadPlanStepOut &)=delete
lldb_private::ThreadPlanStepOut::StopOthers
bool StopOthers() override
Definition: ThreadPlanStepOut.cpp:387
ThreadPlan.h
lldb_private::ThreadPlanStepOut::GetPlanRunState
lldb::StateType GetPlanRunState() override
Definition: ThreadPlanStepOut.cpp:389
lldb_private::Status
Definition: Status.h:44
lldb_private::ThreadPlanStepOut::DidPush
void DidPush() override
Definition: ThreadPlanStepOut.cpp:181
lldb_private::ThreadPlanStepOut::SetFlagsToDefault
void SetFlagsToDefault() override
Definition: ThreadPlanStepOut.h:44
uint32_t
lldb_private::ThreadPlanStepOut::DoWillResume
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
Definition: ThreadPlanStepOut.cpp:391
lldb_private::ThreadPlanStepOut::CalculateReturnValue
void CalculateReturnValue()
Definition: ThreadPlanStepOut.cpp:502
lldb_private::ThreadPlanStepOut::s_default_flag_values
static uint32_t s_default_flag_values
Definition: ThreadPlanStepOut.h:53
lldb_private::Vote
Vote
Definition: lldb-private-enumerations.h:59
lldb_private::ThreadPlanStepOut::m_stop_others
bool m_stop_others
Definition: ThreadPlanStepOut.h:61
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ThreadPlanStepOut::DoPlanExplainsStop
bool DoPlanExplainsStop(Event *event_ptr) override
Definition: ThreadPlanStepOut.cpp:268
lldb_private::ThreadPlanStepOut::~ThreadPlanStepOut
~ThreadPlanStepOut() override
Definition: ThreadPlanStepOut.cpp:189
lldb_private::ThreadPlanStepOut::m_immediate_step_from_function
Function * m_immediate_step_from_function
Definition: ThreadPlanStepOut.h:71
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_private::StackID
Definition: StackID.h:17
lldb_private::ThreadPlanStepOut::GetReturnValueObject
lldb::ValueObjectSP GetReturnValueObject() override
Definition: ThreadPlanStepOut.h:39
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::ThreadPlanStepOut::m_step_out_to_inline_plan_sp
lldb::ThreadPlanSP m_step_out_to_inline_plan_sp
Definition: ThreadPlanStepOut.h:62
lldb_private::ThreadPlanStepOut::ThreadPlanStepOut
ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context, bool first_insn, bool stop_others, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, LazyBool step_out_avoids_code_without_debug_info, bool continue_to_next_branch=false, bool gather_return_value=true)
Definition: ThreadPlanStepOut.cpp:34
lldb_private::ThreadPlanStepOut::m_stepped_past_frames
std::vector< lldb::StackFrameSP > m_stepped_past_frames
Definition: ThreadPlanStepOut.h:72
lldb_private::ThreadPlanStepOut::m_step_out_further_plan_sp
lldb::ThreadPlanSP m_step_out_further_plan_sp
Definition: ThreadPlanStepOut.h:68
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::ThreadPlanStepOut::m_return_valobj_sp
lldb::ValueObjectSP m_return_valobj_sp
Definition: ThreadPlanStepOut.h:73
ThreadPlanShouldStopHere.h