[llvm-branch-commits] [lldb] release/19.x: [lldb] Fix some tests that fail with system libstdc++ (#106885) (PR #107938)
https://github.com/felipepiovezan approved this pull request. This LGTM! https://github.com/llvm/llvm-project/pull/107938 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Extract BuildDebugInfoMDMap from CloneFunctionInto (PR #118622)
https://github.com/felipepiovezan edited https://github.com/llvm/llvm-project/pull/118622 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Extract BuildDebugInfoMDMap from CloneFunctionInto (PR #118622)
@@ -79,14 +79,16 @@ struct ValueMapConfig { static mutex_type *getMutex(const ExtraDataT &/*Data*/) { return nullptr; } }; +/// This type stores Metadata. Used in ValueMap. +using MDMapT = DenseMap; felipepiovezan wrote: I don't think we should have a type alias that is an implementation detail in the `llvm::` namespace, as it adds visibility to this everywhere. We should instead move it to the public `ValueMap` API and refer to it as `ValueMap::MDMapT` (or just spell out the type completely and not worry about the typedef) https://github.com/llvm/llvm-project/pull/118622 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Extract CloneFunctionMetadataInto from CloneFunctionInto (PR #118623)
@@ -200,6 +200,22 @@ bool llvm::BuildDebugInfoMDMap(DenseMap &MD, return ModuleLevelChanges; } +void llvm::CloneFunctionMetadataInto(Function *NewFunc, const Function *OldFunc, + ValueToValueMapTy &VMap, + RemapFlags RemapFlag, + ValueMapTypeRemapper *TypeMapper, + ValueMaterializer *Materializer) { + // Duplicate the metadata that is attached to the cloned function. felipepiovezan wrote: Note that, in the context of this function, there is no "cloned function", it's either `NewFunc` or `OldFunc`. That said, I this comment fits better in the documentation of the header, as there is important information here that callers should be aware https://github.com/llvm/llvm-project/pull/118623 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Extract CloneFunctionMetadataInto from CloneFunctionInto (PR #118623)
@@ -182,6 +182,18 @@ void CloneFunctionAttributesInto(Function *NewFunc, const Function *OldFunc, ValueMapTypeRemapper *TypeMapper = nullptr, ValueMaterializer *Materializer = nullptr); +/// Clone OldFunc's metadata into NewFunc. +/// +/// The caller is expected to populate \p VMap beforehand and set an appropriate +/// \p RemapFlag. +/// +/// NOTE: This function doesn't clone !llvm.dbg.cu when cloning into a different +/// module. Use CloneFunctionInto for that behavior. +void CloneFunctionMetadataInto(Function *NewFunc, const Function *OldFunc, felipepiovezan wrote: Can `NewFunc` or `OldFunc` be null? If not, we should make them references https://github.com/llvm/llvm-project/pull/118623 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Extract CloneFunctionBodyInto from CloneFunctionInto (PR #118624)
@@ -194,6 +194,15 @@ void CloneFunctionMetadataInto(Function *NewFunc, const Function *OldFunc, ValueMapTypeRemapper *TypeMapper = nullptr, ValueMaterializer *Materializer = nullptr); +/// Clone OldFunc's body into NewFunc. +void CloneFunctionBodyInto(Function *NewFunc, const Function *OldFunc, felipepiovezan wrote: Can `NewFunc` / `OldFunc` be nullptr? If not, they should be references https://github.com/llvm/llvm-project/pull/118624 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Extract CloneFunctionBodyInto from CloneFunctionInto (PR #118624)
@@ -361,32 +370,31 @@ void updateProfileCallee( /// Find the 'llvm.experimental.noalias.scope.decl' intrinsics in the specified /// basic blocks and extract their scope. These are candidates for duplication /// when cloning. -void identifyNoAliasScopesToClone( -ArrayRef BBs, SmallVectorImpl &NoAliasDeclScopes); +void identifyNoAliasScopesToClone(ArrayRef BBs, + SmallVectorImpl &NoAliasDeclScopes); /// Find the 'llvm.experimental.noalias.scope.decl' intrinsics in the specified /// instruction range and extract their scope. These are candidates for /// duplication when cloning. -void identifyNoAliasScopesToClone( -BasicBlock::iterator Start, BasicBlock::iterator End, -SmallVectorImpl &NoAliasDeclScopes); +void identifyNoAliasScopesToClone(BasicBlock::iterator Start, + BasicBlock::iterator End, + SmallVectorImpl &NoAliasDeclScopes); /// Duplicate the specified list of noalias decl scopes. /// The 'Ext' string is added as an extension to the name. /// Afterwards, the ClonedScopes contains the mapping of the original scope /// MDNode onto the cloned scope. /// Be aware that the cloned scopes are still part of the original scope domain. -void cloneNoAliasScopes( -ArrayRef NoAliasDeclScopes, -DenseMap &ClonedScopes, -StringRef Ext, LLVMContext &Context); +void cloneNoAliasScopes(ArrayRef NoAliasDeclScopes, +DenseMap &ClonedScopes, +StringRef Ext, LLVMContext &Context); /// Adapt the metadata for the specified instruction according to the /// provided mapping. This is normally used after cloning an instruction, when /// some noalias scopes needed to be cloned. -void adaptNoAliasScopes( -llvm::Instruction *I, const DenseMap &ClonedScopes, -LLVMContext &Context); felipepiovezan wrote: are any of these changes part of the PR? It not, they should not be part of the diff. If you run into this as a result of running `clang-format` in the entire patch, a good way to avoid this is by running `clang-format` on the _diff_ only. For example, (assuming all the changes are unstaged) `git add` the changes you want to stage, and then `git clang-format --staged` https://github.com/llvm/llvm-project/pull/118624 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Extract CloneFunctionBodyInto from CloneFunctionInto (PR #118624)
https://github.com/felipepiovezan approved this pull request. https://github.com/llvm/llvm-project/pull/118624 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC][Utils] Eliminate DISubprogram set from BuildDebugInfoMDMap (PR #118625)
https://github.com/felipepiovezan approved this pull request. https://github.com/llvm/llvm-project/pull/118625 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] [lldb] Create ThreadPlanStepOut ctor that never skips frames (PR #136163)
https://github.com/felipepiovezan updated https://github.com/llvm/llvm-project/pull/136163 >From 0a2dc4a280d83ca35bc4458ecb939f96e4dee8af Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Thu, 17 Apr 2025 11:34:39 -0700 Subject: [PATCH 1/3] fixup! Run clang-format --- lldb/source/Target/ThreadPlanStepOut.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index b3c9a790487d4..f2606403016a6 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -79,8 +79,8 @@ ThreadPlanStepOut::ThreadPlanStepOut( ComputeTargetFrame(thread, frame_idx, m_stepped_past_frames); StackFrameSP immediate_return_from_sp(thread.GetStackFrameAtIndex(frame_idx)); - SetupReturnAddress(return_frame_sp, immediate_return_from_sp, - frame_idx, continue_to_next_branch); + SetupReturnAddress(return_frame_sp, immediate_return_from_sp, frame_idx, + continue_to_next_branch); } void ThreadPlanStepOut::SetupReturnAddress( @@ -101,8 +101,8 @@ void ThreadPlanStepOut::SetupReturnAddress( // First queue a plan that gets us to this inlined frame, and when we get // there we'll queue a second plan that walks us out of this frame. m_step_out_to_inline_plan_sp = std::make_shared( - GetThread(), nullptr, false, m_stop_others, eVoteNoOpinion, eVoteNoOpinion, - frame_idx - 1, eLazyBoolNo, continue_to_next_branch); + GetThread(), nullptr, false, m_stop_others, eVoteNoOpinion, + eVoteNoOpinion, frame_idx - 1, eLazyBoolNo, continue_to_next_branch); static_cast(m_step_out_to_inline_plan_sp.get()) ->SetShouldStopHereCallbacks(nullptr, nullptr); m_step_out_to_inline_plan_sp->SetPrivate(true); >From 923f6c73fae39c0f4686a65282c81755fa876b70 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Thu, 17 Apr 2025 09:36:22 -0700 Subject: [PATCH 2/3] [lldb] Create ThreadPlanStepOut ctor that never skips frames The function QueueThreadPlanForStepOutNoShouldStop has the semantics of "go this parent frame"; ThreadPlanStepOut needs to respect that, not skipping over any frames it finds uninteresting. This commit creates a constructor that respects such instruction. --- lldb/include/lldb/Target/ThreadPlanStepOut.h | 9 lldb/source/Target/Thread.cpp| 5 ++--- lldb/source/Target/ThreadPlanStepOut.cpp | 22 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lldb/include/lldb/Target/ThreadPlanStepOut.h b/lldb/include/lldb/Target/ThreadPlanStepOut.h index e414a6e0a2d49..9a62f6102d368 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepOut.h +++ b/lldb/include/lldb/Target/ThreadPlanStepOut.h @@ -17,6 +17,9 @@ namespace lldb_private { class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere { public: + /// Creates a thread plan to step out from frame_idx, skipping parent frames + /// that artificial and hidden frames. Also skips frames without debug info + /// based on 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, @@ -24,6 +27,12 @@ class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere { bool continue_to_next_branch = false, bool gather_return_value = true); + /// Creates a thread plan to step out from frame_idx to frame_idx + 1. + ThreadPlanStepOut(Thread &thread, bool stop_others, Vote report_stop_vote, +Vote report_run_vote, uint32_t frame_idx, +bool continue_to_next_branch = false, +bool gather_return_value = true); + ~ThreadPlanStepOut() override; void GetDescription(Stream *s, lldb::DescriptionLevel level) override; diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index accc4708c24e1..b0e0f1e67c060 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1360,9 +1360,8 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop( const bool calculate_return_value = false; // No need to calculate the return value here. ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut( - *this, addr_context, first_insn, stop_other_threads, report_stop_vote, - report_run_vote, frame_idx, eLazyBoolNo, continue_to_next_branch, - calculate_return_value)); + *this, stop_other_threads, report_stop_vote, report_run_vote, frame_idx, + continue_to_next_branch, calculate_return_value)); ThreadPlanStepOut *new_plan = static_cast(thread_plan_sp.get()); diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.c
[llvm-branch-commits] [lldb] [lldb] Create ThreadPlanStepOut ctor that never skips frames (PR #136163)
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/136163 The function QueueThreadPlanForStepOutNoShouldStop has the semantics of "go this parent frame"; ThreadPlanStepOut needs to respect that, not skipping over any frames it finds uninteresting. This commit creates a constructor that respects such instruction. >From bde0158076982b16b3ae8341fa7553e1a22eb33a Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Thu, 17 Apr 2025 09:36:22 -0700 Subject: [PATCH] [lldb] Create ThreadPlanStepOut ctor that never skips frames The function QueueThreadPlanForStepOutNoShouldStop has the semantics of "go this parent frame"; ThreadPlanStepOut needs to respect that, not skipping over any frames it finds uninteresting. This commit creates a constructor that respects such instruction. --- lldb/include/lldb/Target/ThreadPlanStepOut.h | 9 lldb/source/Target/Thread.cpp| 2 +- lldb/source/Target/ThreadPlanStepOut.cpp | 22 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Target/ThreadPlanStepOut.h b/lldb/include/lldb/Target/ThreadPlanStepOut.h index f37d09467dda3..bc106380bca5c 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepOut.h +++ b/lldb/include/lldb/Target/ThreadPlanStepOut.h @@ -17,12 +17,21 @@ namespace lldb_private { class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere { public: + /// Creates a thread plan to step out from frame_idx, skipping parent frames + /// that artificial and hidden frames. Also skips frames without debug info + /// based on step_out_avoids_code_without_debug_info. ThreadPlanStepOut(Thread &thread, 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 to frame_idx + 1. + ThreadPlanStepOut(Thread &thread, bool stop_others, Vote report_stop_vote, +Vote report_run_vote, uint32_t frame_idx, +bool continue_to_next_branch = false, +bool gather_return_value = true); + ~ThreadPlanStepOut() override; void GetDescription(Stream *s, lldb::DescriptionLevel level) override; diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index ddd4315b6cc9e..1d941a3614275 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1360,7 +1360,7 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop( false; // No need to calculate the return value here. ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut( *this, stop_other_threads, report_stop_vote, report_run_vote, frame_idx, - eLazyBoolNo, continue_to_next_branch, calculate_return_value)); + continue_to_next_branch, calculate_return_value)); ThreadPlanStepOut *new_plan = static_cast(thread_plan_sp.get()); diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 546405c267601..c7da0e2be89b4 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -83,6 +83,28 @@ ThreadPlanStepOut::ThreadPlanStepOut( frame_idx, continue_to_next_branch); } +ThreadPlanStepOut::ThreadPlanStepOut(Thread &thread, bool stop_others, + Vote report_stop_vote, + Vote report_run_vote, uint32_t frame_idx, + bool continue_to_next_branch, + bool gather_return_value) +: ThreadPlan(ThreadPlan::eKindStepOut, "Step out", thread, report_stop_vote, + report_run_vote), + ThreadPlanShouldStopHere(this), m_return_bp_id(LLDB_INVALID_BREAK_ID), + m_return_addr(LLDB_INVALID_ADDRESS), m_stop_others(stop_others), + m_immediate_step_from_function(nullptr), + m_calculate_return_value(gather_return_value) { + SetFlagsToDefault(); + m_step_from_insn = thread.GetRegisterContext()->GetPC(0); + + StackFrameSP return_frame_sp = thread.GetStackFrameAtIndex(frame_idx + 1); + StackFrameSP immediate_return_from_sp = + thread.GetStackFrameAtIndex(frame_idx); + + SetupReturnAddress(return_frame_sp, immediate_return_from_sp, frame_idx, + continue_to_next_branch); +} + void ThreadPlanStepOut::SetupReturnAddress( StackFrameSP return_frame_sp, StackFrameSP immediate_return_from_sp, uint32_t frame_idx, bool continue_to_next_branch) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] [lldb][nfc] Remove unused parameters in ThreadPlanStepOut ctor (PR #136161)
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/136161 These have been unused for at least a decade. >From e668877c091baf943e5030e2f49f4e68015fc477 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Thu, 17 Apr 2025 08:18:13 -0700 Subject: [PATCH] [lldb][nfc] Remove unused parameters in ThreadPlanStepOut ctor These have been unused for at least a decade. --- lldb/include/lldb/API/SBThreadPlan.h | 1 + lldb/include/lldb/Target/Thread.h | 35 +++ lldb/include/lldb/Target/ThreadPlanStepOut.h | 8 ++--- lldb/source/API/SBThread.cpp | 8 ++--- lldb/source/API/SBThreadPlan.cpp | 4 +-- lldb/source/Commands/CommandObjectThread.cpp | 3 +- ...pleThreadPlanStepThroughObjCTrampoline.cpp | 8 ++--- lldb/source/Target/Thread.cpp | 27 +++--- .../Target/ThreadPlanCallOnFunctionExit.cpp | 2 -- .../Target/ThreadPlanShouldStopHere.cpp | 4 +-- .../Target/ThreadPlanStepInstruction.cpp | 3 +- lldb/source/Target/ThreadPlanStepOut.cpp | 7 ++-- .../source/Target/ThreadPlanStepOverRange.cpp | 3 +- 13 files changed, 38 insertions(+), 75 deletions(-) diff --git a/lldb/include/lldb/API/SBThreadPlan.h b/lldb/include/lldb/API/SBThreadPlan.h index d02ab80f76a76..9b7ac03d8265c 100644 --- a/lldb/include/lldb/API/SBThreadPlan.h +++ b/lldb/include/lldb/API/SBThreadPlan.h @@ -100,6 +100,7 @@ class LLDB_API SBThreadPlan { lldb::addr_t range_size, SBError &error); + // Note: first_insn is not used. SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to, bool first_insn = false); SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to, diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 6ede7fa301a82..1454f2ff4d18a 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -843,18 +843,6 @@ class Thread : public std::enable_shared_from_this, ///this one. ///Otherwise this plan will go on the end of the plan stack. /// - /// \param[in] addr_context - ///When dealing with stepping through inlined functions the current PC is - ///not enough information to know - ///what "step" means. For instance a series of nested inline functions - ///might start at the same address. - // The \a addr_context provides the current symbol context the step - ///is supposed to be out of. - // FIXME: Currently unused. - /// - /// \param[in] first_insn - /// \b true if this is the first instruction of a function. - /// /// \param[in] stop_other_threads ///\b true if we will stop other threads while we single step this one. /// @@ -876,9 +864,8 @@ class Thread : public std::enable_shared_from_this, /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. 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, + bool abort_other_plans, 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 @@ -892,18 +879,6 @@ class Thread : public std::enable_shared_from_this, ///this one. ///Otherwise this plan will go on the end of the plan stack. /// - /// \param[in] addr_context - ///When dealing with stepping through inlined functions the current PC is - ///not enough information to know - ///what "step" means. For instance a series of nested inline functions - ///might start at the same address. - // The \a addr_context provides the current symbol context the step - ///is supposed to be out of. - // FIXME: Currently unused. - /// - /// \param[in] first_insn - /// \b true if this is the first instruction of a function. - /// /// \param[in] stop_other_threads ///\b true if we will stop other threads while we single step this one. /// @@ -940,9 +915,9 @@ class Thread : public std::enable_shared_from_this, /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop( - 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, bool continue_to_next_branch = false); + bool abort_other_plans, bool
[llvm-branch-commits] [lldb] [lldb][nfc] Split the constructor of ThreadPlanStepOut (PR #136160)
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/136160 A subsequent commit will create a new constructor for ThreadPlanStepOut, which needs to reuse much of the same logic of the existing constructor. This commit places all of that reusable logic into a separate function. >From 662baea555175e39ca4f0f170f2ef197c53af60d Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Thu, 17 Apr 2025 07:52:19 -0700 Subject: [PATCH] [lldb][nfc] Split the constructor of ThreadPlanStepOut A subsequent commit will create a new constructor for ThreadPlanStepOut, which needs to reuse much of the same logic of the existing constructor. This commit places all of that reusable logic into a separate function. --- lldb/include/lldb/Target/ThreadPlanStepOut.h | 4 lldb/source/Target/ThreadPlanStepOut.cpp | 9 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Target/ThreadPlanStepOut.h b/lldb/include/lldb/Target/ThreadPlanStepOut.h index 013c675afc33d..e414a6e0a2d49 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepOut.h +++ b/lldb/include/lldb/Target/ThreadPlanStepOut.h @@ -82,6 +82,10 @@ class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere { LazyBool step_out_avoids_code_without_debug_info); void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info); + + void SetupReturnAddress(lldb::StackFrameSP return_frame_sp, + lldb::StackFrameSP immediate_return_from_sp, + uint32_t frame_idx, bool continue_to_next_branch); // Need an appropriate marker for the current stack so we can tell step out // from step in. diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 26c1abe710319..b3c9a790487d4 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -79,6 +79,13 @@ ThreadPlanStepOut::ThreadPlanStepOut( ComputeTargetFrame(thread, frame_idx, m_stepped_past_frames); StackFrameSP immediate_return_from_sp(thread.GetStackFrameAtIndex(frame_idx)); + SetupReturnAddress(return_frame_sp, immediate_return_from_sp, + frame_idx, continue_to_next_branch); +} + +void ThreadPlanStepOut::SetupReturnAddress( +StackFrameSP return_frame_sp, StackFrameSP immediate_return_from_sp, +uint32_t frame_idx, bool continue_to_next_branch) { if (!return_frame_sp || !immediate_return_from_sp) return; // we can't do anything here. ValidatePlan() will return false. @@ -94,7 +101,7 @@ ThreadPlanStepOut::ThreadPlanStepOut( // First queue a plan that gets us to this inlined frame, and when we get // there we'll queue a second plan that walks us out of this frame. m_step_out_to_inline_plan_sp = std::make_shared( - thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion, + GetThread(), nullptr, false, m_stop_others, eVoteNoOpinion, eVoteNoOpinion, frame_idx - 1, eLazyBoolNo, continue_to_next_branch); static_cast(m_step_out_to_inline_plan_sp.get()) ->SetShouldStopHereCallbacks(nullptr, nullptr); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] [lldb] Create ThreadPlanStepOut ctor that never skips frames (PR #136163)
@@ -17,12 +17,21 @@ namespace lldb_private { class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere { public: + /// Creates a thread plan to step out from frame_idx, skipping parent frames + /// that artificial and hidden frames. Also skips frames without debug info felipepiovezan wrote: typo: that ARE* https://github.com/llvm/llvm-project/pull/136163 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits