39 std::vector<StackFrameSP> &skipped_frames) {
40 uint32_t frame_idx = start_frame_idx + 1;
41 StackFrameSP return_frame_sp = thread.GetStackFrameAtIndex(frame_idx);
45 while (return_frame_sp->IsArtificial() || return_frame_sp->IsHidden()) {
46 skipped_frames.push_back(return_frame_sp);
49 return_frame_sp = thread.GetStackFrameAtIndex(frame_idx);
53 if (!return_frame_sp) {
55 "Can't step out of frame with artificial ancestors");
59 return return_frame_sp;
65 Vote report_stop_vote,
Vote report_run_vote, uint32_t frame_idx,
66 LazyBool step_out_avoids_code_without_debug_info,
67 bool continue_to_next_branch,
bool gather_return_value)
82 StackFrameSP immediate_return_from_sp(thread.GetStackFrameAtIndex(frame_idx));
85 continue_to_next_branch);
89 Vote report_stop_vote,
90 Vote report_run_vote, uint32_t frame_idx,
91 bool continue_to_next_branch,
92 bool gather_return_value)
102 StackFrameSP return_frame_sp = thread.GetStackFrameAtIndex(frame_idx + 1);
104 thread.GetStackFrameAtIndex(frame_idx);
107 continue_to_next_branch);
112 uint32_t frame_idx,
bool continue_to_next_branch) {
113 if (!return_frame_sp || !immediate_return_from_sp)
123 if (immediate_return_from_sp->IsInlined()) {
131 ->SetShouldStopHereCallbacks(
nullptr,
nullptr);
142 Address return_address(return_frame_sp->GetFrameCodeAddress());
143 if (continue_to_next_branch) {
146 Address return_address_decr_pc = return_address;
147 if (return_address_decr_pc.
GetOffset() > 0)
148 return_address_decr_pc.
Slide(-1);
151 &return_address_sc, lldb::eSymbolContextLineEntry);
153 const bool include_inlined_functions =
false;
155 include_inlined_functions);
157 return_address =
m_process.AdvanceAddressToNextBranchInstruction(
158 return_address, range);
168 uint32_t permissions = 0;
171 LLDB_LOGF(log,
"ThreadPlanStepOut(%p): Return address (0x%" PRIx64
172 ") permissions not found.",
static_cast<void *
>(
this),
174 }
else if (!(permissions & ePermissionsExecutable)) {
176 ") did not point to executable memory.",
178 LLDB_LOGF(log,
"ThreadPlanStepOut(%p): %s",
static_cast<void *
>(
this),
186 if (return_bp !=
nullptr) {
194 if (immediate_return_from_sp) {
196 immediate_return_from_sp->GetSymbolContext(eSymbolContextFunction);
214 LazyBool step_out_avoids_code_without_debug_info) {
215 bool avoid_nodebug =
true;
216 switch (step_out_avoids_code_without_debug_info) {
218 avoid_nodebug =
true;
221 avoid_nodebug =
false;
252 s->
PutCString(
"Stepping out to inlined frame so we can walk through it.");
254 s->
PutCString(
"Stepping out by stepping through inlined function.");
288 frame_sp->DumpUsingSettingsFormat(s);
302 "Could not create hardware breakpoint for thread plan.");
308 error->PutCString(
"Could not create return address breakpoint.");
310 error->PutCString(
" ");
341 StopReason reason = stop_info_sp->GetStopReason();
346 m_process.GetBreakpointSiteList().FindByID(stop_info_sp->GetValue()));
374 if (!site_sp->ContainsUserBreakpointForThread(
GetThread()))
453 if (return_bp !=
nullptr)
462 if (return_bp !=
nullptr)
479 LLDB_LOGF(log,
"Completed step out plan.");
497 StackFrameSP immediate_return_from_sp(thread.GetStackFrameAtIndex(0));
498 if (!immediate_return_from_sp)
504 immediate_return_from_sp->Dump(&s,
true,
false);
508 Block *from_block = immediate_return_from_sp->GetFrameBlock();
523 std::make_shared<ThreadPlanStepOverRange>(
524 thread, inline_range, inlined_sc, run_mode, avoid_no_debug);
532 if (!step_through_inline_plan_ptr->
ValidatePlan(&errors)) {
534 delete step_through_inline_plan_ptr;
538 for (
size_t i = 1; i < num_ranges; i++) {
540 step_through_inline_plan_ptr->
AddRange(inline_range);
560 if (std::optional<ValueObjectSP> error_sp =
570 .GetFunctionReturnType();
571 if (return_compiler_type) {
575 std::optional<CompilerType> runtime_type =
576 runtime->GetRuntimeType(return_compiler_type);
577 if (runtime_type && *runtime_type)
578 return_compiler_type = *runtime_type;
583 abi_sp->GetReturnValueObject(
GetThread(), return_compiler_type))
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
static StackFrameSP ComputeTargetFrame(Thread &thread, uint32_t start_frame_idx, std::vector< StackFrameSP > &skipped_frames)
Computes the target frame this plan should step out to.
A section + offset based address range class.
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
uint32_t CalculateSymbolContext(SymbolContext *sc, lldb::SymbolContextItem resolve_scope=lldb::eSymbolContextEverything) const
Reconstruct a symbol context from an address.
@ DumpStyleResolvedDescription
Display the details about what an address resolves to.
@ DumpStyleLoadAddress
Display as the load address (if resolved).
bool Slide(int64_t offset)
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX, bool all_ranges=false, std::optional< Stream::HighlightSettings > settings=std::nullopt) const
Dump a description of this object to a Stream.
lldb::addr_t GetOffset() const
Get the section relative offset value.
A class that describes a single lexical block.
void CalculateSymbolContext(SymbolContext *sc) override
Reconstruct the object's symbol context into sc.
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range)
size_t GetNumRanges() const
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
bool HasResolvedLocations() const
Return whether this breakpoint has any resolved locations.
void SetThreadID(lldb::tid_t thread_id)
Set the valid thread to be checked when the breakpoint is hit.
void SetEnabled(bool enable) override
If enable is true, enable the breakpoint, if false disable it.
Generic representation of a type in a programming language.
lldb::LanguageType GetMinimumLanguage()
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
A description of how to find an error thrown by a function.
bool IsYoungerThan(const StackID &other, Process &process) const
Returns true if this StackID corresponds to a frame younger (i.e.
lldb::break_id_t GetID() const
const char * GetData() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
lldb::TargetSP target_sp
The Target for a given query.
LineEntry line_entry
The LineEntry for a given query.
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
bool RemoveBreakpointByID(lldb::break_id_t break_id)
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
lldb_private::Flags m_flags
virtual lldb::ThreadPlanSP QueueStepOutFromHerePlan(Flags &flags, lldb::FrameComparison operation, Status &status)
ThreadPlanShouldStopHere(ThreadPlan *owner)
lldb_private::Flags & GetFlags()
bool InvokeShouldStopHereCallback(lldb::FrameComparison operation, Status &status)
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
~ThreadPlanStepOut() override
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
lldb::break_id_t m_return_bp_id
bool IsPlanStale() override
bool QueueInlinedStepPlan(bool queue_now)
lldb::addr_t m_return_addr
void CalculateReturnValue()
Function * m_immediate_step_from_function
lldb::StateType GetPlanRunState() override
lldb::ThreadPlanSP m_step_out_further_plan_sp
LanguageRuntime::ThrownErrorLocation m_thrown_error_location
bool m_calculate_return_value
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
bool MischiefManaged() override
lldb::ThreadPlanSP m_step_through_inline_plan_sp
bool ShouldStop(Event *event_ptr) override
static uint32_t s_default_flag_values
StreamString m_constructor_errors
void SetFlagsToDefault() override
StackID m_immediate_step_from_id
lldb::addr_t m_step_from_insn
bool StopOthers() override
lldb::ThreadPlanSP m_step_out_to_inline_plan_sp
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
void AddRange(const AddressRange &new_range)
ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote report_stop_vote, Vote report_run_vote)
bool IsUsuallyUnexplainedStopReason(lldb::StopReason)
void SetPlanComplete(bool success=true)
Thread & GetThread()
Returns the Thread that is using this thread plan.
void SetOkayToDiscard(bool value)
virtual bool MischiefManaged()
bool m_could_not_resolve_hw_bp
lldb::StopInfoSP GetPrivateStopInfo()
bool GetStepOutAvoidsNoDebug() const
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
StateType
Process and Thread States.
@ eStateRunning
Process or thread is running and can't be examined.
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
StopReason
Thread stop reasons.
AddressRange GetSameLineContiguousAddressRange(bool include_inlined_functions) const
Give the range for this LineEntry + any additional LineEntries for this same source line that are con...
bool IsValid() const
Check if a line entry object is valid.
A value a function returned.
An error a function threw instead of returning.