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
13#include "lldb/Target/Thread.h"
16
17namespace lldb_private {
18
20public:
21 /// Creates a thread plan to step out from frame_idx, skipping parent frames
22 /// if they are artificial or hidden frames. Also skips frames without debug
23 /// info based on step_out_avoids_code_without_debug_info.
24 ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context,
25 bool first_insn, bool stop_others, Vote report_stop_vote,
26 Vote report_run_vote, uint32_t frame_idx,
27 LazyBool step_out_avoids_code_without_debug_info,
28 bool continue_to_next_branch = false,
29 bool gather_return_value = true);
30
31 /// Creates a thread plan to step out from frame_idx to frame_idx + 1.
32 ThreadPlanStepOut(Thread &thread, bool stop_others, Vote report_stop_vote,
33 Vote report_run_vote, uint32_t frame_idx,
34 bool continue_to_next_branch = false,
35 bool gather_return_value = true);
36
37 ~ThreadPlanStepOut() override;
38
39 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
40 bool ValidatePlan(Stream *error) override;
41 bool ShouldStop(Event *event_ptr) override;
42 bool StopOthers() override;
43 void SetStopOthers(bool new_value) override { m_stop_others = new_value; }
45 bool WillStop() override;
46 bool MischiefManaged() override;
47 void DidPush() override;
48 bool IsPlanStale() override;
49
51
52protected:
56
57 bool DoPlanExplainsStop(Event *event_ptr) override;
58 bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
59 bool QueueInlinedStepPlan(bool queue_now);
60
61private:
62 static uint32_t s_default_flag_values; // These are the default flag values
63 // for the ThreadPlanStepThrough.
64
72 // out to the real function
73 // containing
74 // an inlined frame so we can then step out of that.
76 // the inlined frame(s).
77 lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out
78 // if ShouldStopHere told us
79 // to.
81 std::vector<lldb::StackFrameSP> m_stepped_past_frames;
86
88 bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
89 bool stop_others, Vote report_stop_vote, Vote report_run_vote,
90 uint32_t frame_idx, Status &status,
91 LazyBool step_out_avoids_code_without_debug_info);
92
93 void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
94
95 void SetupReturnAddress(lldb::StackFrameSP return_frame_sp,
96 lldb::StackFrameSP immediate_return_from_sp,
97 uint32_t frame_idx, bool continue_to_next_branch);
98 // Need an appropriate marker for the current stack so we can tell step out
99 // from step in.
100
102
105};
106
107} // namespace lldb_private
108
109#endif // LLDB_TARGET_THREADPLANSTEPOUT_H
static llvm::raw_ostream & error(Stream &strm)
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Definition Flags.h:73
A class that describes a function.
Definition Function.h:386
A description of how to find an error thrown by a function.
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
Defines a symbol context baton that can be handed other debug core functions.
ThreadPlanReturnValue GetReturnValue() override
If the completion of the thread plan stepped out of or called a function, the value the function retu...
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
std::vector< lldb::StackFrameSP > m_stepped_past_frames
void SetupReturnAddress(lldb::StackFrameSP return_frame_sp, lldb::StackFrameSP immediate_return_from_sp, uint32_t frame_idx, bool continue_to_next_branch)
ThreadPlanReturnValue m_return_value
bool QueueInlinedStepPlan(bool queue_now)
ThreadPlanStepOut(const ThreadPlanStepOut &)=delete
const ThreadPlanStepOut & operator=(const ThreadPlanStepOut &)=delete
lldb::StateType GetPlanRunState() override
lldb::ThreadPlanSP m_step_out_further_plan_sp
void SetStopOthers(bool new_value) override
LanguageRuntime::ThrownErrorLocation m_thrown_error_location
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info)
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)
Creates a thread plan to step out from frame_idx, skipping parent frames if they are artificial or hi...
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
bool DoPlanExplainsStop(Event *event_ptr) override
lldb::ThreadPlanSP m_step_through_inline_plan_sp
bool ShouldStop(Event *event_ptr) override
lldb::ThreadPlanSP m_step_out_to_inline_plan_sp
ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote report_stop_vote, Vote report_run_vote)
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:1376
A class that represents a running process on the host machine.
std::variant< std::monostate, ReturnedValue, ThrownError > ThreadPlanReturnValue
What a completed thread plan computed for the function it stepped out of or called: nothing,...
Definition Thread.h:82
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
StateType
Process and Thread States.
int32_t break_id_t
Definition lldb-types.h:88
uint64_t addr_t
Definition lldb-types.h:80