kastiglione created this revision. kastiglione added a reviewer: jingham. kastiglione requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
`QueueThreadPlanForStepInRange` accepts a `step_into_target`, but the constructor for `ThreadPlanStepInRange` has not. Instead, the caller would optionally call `SetStepInTarget()`. This change adds `step_into_target` as a constructor argument. This simplifies construction of `ThreadPlanSP`, by avoiding a subsequent downcast and conditional assignment. This constructor is already used in downstream repos. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D96539 Files: lldb/include/lldb/Target/ThreadPlanStepInRange.h lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp lldb/source/Target/Thread.cpp lldb/source/Target/ThreadPlanStepInRange.cpp Index: lldb/source/Target/ThreadPlanStepInRange.cpp =================================================================== --- lldb/source/Target/ThreadPlanStepInRange.cpp +++ lldb/source/Target/ThreadPlanStepInRange.cpp @@ -33,14 +33,14 @@ ThreadPlanStepInRange::ThreadPlanStepInRange( Thread &thread, const AddressRange &range, - const SymbolContext &addr_context, lldb::RunMode stop_others, - LazyBool step_in_avoids_code_without_debug_info, + const SymbolContext &addr_context, const char *step_into_target, + lldb::RunMode stop_others, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info) : ThreadPlanStepRange(ThreadPlan::eKindStepInRange, "Step Range stepping in", thread, range, addr_context, stop_others), ThreadPlanShouldStopHere(this), m_step_past_prologue(true), - m_virtual_step(false) { + m_virtual_step(false), m_step_into_target(step_into_target) { SetCallbacks(); SetFlagsToDefault(); SetupAvoidNoDebug(step_in_avoids_code_without_debug_info, Index: lldb/source/Target/Thread.cpp =================================================================== --- lldb/source/Target/Thread.cpp +++ lldb/source/Target/Thread.cpp @@ -1289,16 +1289,10 @@ lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info) { - ThreadPlanSP thread_plan_sp( - new ThreadPlanStepInRange(*this, range, addr_context, stop_other_threads, - step_in_avoids_code_without_debug_info, - step_out_avoids_code_without_debug_info)); - ThreadPlanStepInRange *plan = - static_cast<ThreadPlanStepInRange *>(thread_plan_sp.get()); - - if (step_in_target) - plan->SetStepInTarget(step_in_target); - + ThreadPlanSP thread_plan_sp(new ThreadPlanStepInRange( + *this, range, addr_context, step_in_target, stop_other_threads, + step_in_avoids_code_without_debug_info, + step_out_avoids_code_without_debug_info)); status = QueueThreadPlan(thread_plan_sp, abort_other_plans); return thread_plan_sp; } Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp +++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp @@ -397,8 +397,8 @@ // We create a ThreadPlan to keep stepping through using the address range // of the current function. ret_plan_sp = std::make_shared<ThreadPlanStepInRange>( - thread, range_of_curr_func, sc, eOnlyThisThread, eLazyBoolYes, - eLazyBoolYes); + thread, range_of_curr_func, sc, nullptr, eOnlyThisThread, + eLazyBoolYes, eLazyBoolYes); return ret_plan_sp; } } Index: lldb/include/lldb/Target/ThreadPlanStepInRange.h =================================================================== --- lldb/include/lldb/Target/ThreadPlanStepInRange.h +++ lldb/include/lldb/Target/ThreadPlanStepInRange.h @@ -22,7 +22,7 @@ public: ThreadPlanStepInRange(Thread &thread, const AddressRange &range, const SymbolContext &addr_context, - lldb::RunMode stop_others, + const char *step_into_target, lldb::RunMode stop_others, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info); @@ -34,10 +34,6 @@ void SetAvoidRegexp(const char *name); - void SetStepInTarget(const char *target) { - m_step_into_target.SetCString(target); - } - static void SetDefaultFlagValue(uint32_t new_value); bool IsVirtualStep() override;
Index: lldb/source/Target/ThreadPlanStepInRange.cpp =================================================================== --- lldb/source/Target/ThreadPlanStepInRange.cpp +++ lldb/source/Target/ThreadPlanStepInRange.cpp @@ -33,14 +33,14 @@ ThreadPlanStepInRange::ThreadPlanStepInRange( Thread &thread, const AddressRange &range, - const SymbolContext &addr_context, lldb::RunMode stop_others, - LazyBool step_in_avoids_code_without_debug_info, + const SymbolContext &addr_context, const char *step_into_target, + lldb::RunMode stop_others, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info) : ThreadPlanStepRange(ThreadPlan::eKindStepInRange, "Step Range stepping in", thread, range, addr_context, stop_others), ThreadPlanShouldStopHere(this), m_step_past_prologue(true), - m_virtual_step(false) { + m_virtual_step(false), m_step_into_target(step_into_target) { SetCallbacks(); SetFlagsToDefault(); SetupAvoidNoDebug(step_in_avoids_code_without_debug_info, Index: lldb/source/Target/Thread.cpp =================================================================== --- lldb/source/Target/Thread.cpp +++ lldb/source/Target/Thread.cpp @@ -1289,16 +1289,10 @@ lldb::RunMode stop_other_threads, Status &status, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info) { - ThreadPlanSP thread_plan_sp( - new ThreadPlanStepInRange(*this, range, addr_context, stop_other_threads, - step_in_avoids_code_without_debug_info, - step_out_avoids_code_without_debug_info)); - ThreadPlanStepInRange *plan = - static_cast<ThreadPlanStepInRange *>(thread_plan_sp.get()); - - if (step_in_target) - plan->SetStepInTarget(step_in_target); - + ThreadPlanSP thread_plan_sp(new ThreadPlanStepInRange( + *this, range, addr_context, step_in_target, stop_other_threads, + step_in_avoids_code_without_debug_info, + step_out_avoids_code_without_debug_info)); status = QueueThreadPlan(thread_plan_sp, abort_other_plans); return thread_plan_sp; } Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp +++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp @@ -397,8 +397,8 @@ // We create a ThreadPlan to keep stepping through using the address range // of the current function. ret_plan_sp = std::make_shared<ThreadPlanStepInRange>( - thread, range_of_curr_func, sc, eOnlyThisThread, eLazyBoolYes, - eLazyBoolYes); + thread, range_of_curr_func, sc, nullptr, eOnlyThisThread, + eLazyBoolYes, eLazyBoolYes); return ret_plan_sp; } } Index: lldb/include/lldb/Target/ThreadPlanStepInRange.h =================================================================== --- lldb/include/lldb/Target/ThreadPlanStepInRange.h +++ lldb/include/lldb/Target/ThreadPlanStepInRange.h @@ -22,7 +22,7 @@ public: ThreadPlanStepInRange(Thread &thread, const AddressRange &range, const SymbolContext &addr_context, - lldb::RunMode stop_others, + const char *step_into_target, lldb::RunMode stop_others, LazyBool step_in_avoids_code_without_debug_info, LazyBool step_out_avoids_code_without_debug_info); @@ -34,10 +34,6 @@ void SetAvoidRegexp(const char *name); - void SetStepInTarget(const char *target) { - m_step_into_target.SetCString(target); - } - static void SetDefaultFlagValue(uint32_t new_value); bool IsVirtualStep() override;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits