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 liblldb_ThreadPlanStepOut_h_
10 #define liblldb_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 stop_vote,
22  Vote 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 {
45  GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
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 
56  lldb::addr_t m_step_from_insn;
57  StackID m_step_out_to_id;
58  StackID m_immediate_step_from_id;
59  lldb::break_id_t m_return_bp_id;
60  lldb::addr_t m_return_addr;
61  bool m_stop_others;
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.
71  Function *m_immediate_step_from_function;
72  std::vector<lldb::StackFrameSP> m_stepped_past_frames;
73  lldb::ValueObjectSP m_return_valobj_sp;
74  bool m_calculate_return_value;
75 
76  friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut(
77  bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
78  bool stop_others, Vote stop_vote, Vote run_vote, uint32_t frame_idx,
79  Status &status, LazyBool step_out_avoids_code_without_debug_info);
80 
81  void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
82  // Need an appropriate marker for the current stack so we can tell step out
83  // from step in.
84 
85  void CalculateReturnValue();
86 
87  DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOut);
88 };
89 
90 } // namespace lldb_private
91 
92 #endif // liblldb_ThreadPlanStepOut_h_
bool DoPlanExplainsStop(Event *event_ptr) override
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
bool ShouldStop(Event *event_ptr) override
int32_t break_id_t
Definition: lldb-types.h:88
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context, bool first_insn, bool stop_others, Vote stop_vote, Vote 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)
bool QueueInlinedStepPlan(bool queue_now)
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
A class that describes a function.
Definition: Function.h:323
ValueType Set(ValueType mask)
Set one or more flags by logical OR&#39;ing mask with the current flags.
Definition: Flags.h:84
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
uint64_t addr_t
Definition: lldb-types.h:83
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
lldb::ValueObjectSP GetReturnValueObject() override
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut(bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote stop_vote, Vote 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:1442
lldb::StateType GetPlanRunState() override
An error handling class.
Definition: Status.h:44