Author: Dave Lee Date: 2021-02-19T13:04:53-08:00 New Revision: 9d3b9e5799f6b1ac3869df977c82304e0121d256
URL: https://github.com/llvm/llvm-project/commit/9d3b9e5799f6b1ac3869df977c82304e0121d256 DIFF: https://github.com/llvm/llvm-project/commit/9d3b9e5799f6b1ac3869df977c82304e0121d256.diff LOG: [lldb] Rename {stop,run}_vote to report_{stop,run}_vote Rename `stop_vote` and `run_vote` to `report_stop_vote` and `report_run_vote` respectively. These variables are limited to logic involving (event) reporting only. This naming is intended to make their context more clear. Differential Revision: https://reviews.llvm.org/D96917 Added: Modified: lldb/include/lldb/Target/Thread.h lldb/include/lldb/Target/ThreadPlan.h lldb/include/lldb/Target/ThreadPlanStepInstruction.h lldb/include/lldb/Target/ThreadPlanStepOut.h lldb/source/Target/Process.cpp lldb/source/Target/Thread.cpp lldb/source/Target/ThreadPlan.cpp lldb/source/Target/ThreadPlanBase.cpp lldb/source/Target/ThreadPlanStepInstruction.cpp lldb/source/Target/ThreadPlanStepOut.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index b797e4d1ee97..916493c061bb 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -781,10 +781,10 @@ class Thread : public std::enable_shared_from_this<Thread>, /// \param[in] stop_other_threads /// \b true if we will stop other threads while we single step this one. /// - /// \param[in] stop_vote + /// \param[in] report_stop_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// - /// \param[in] run_vote + /// \param[in] report_run_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// /// \param[out] status @@ -800,7 +800,7 @@ class Thread : public std::enable_shared_from_this<Thread>, /// plan could not be queued. virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, - bool stop_other_threads, Vote stop_vote, Vote run_vote, + 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); @@ -830,10 +830,10 @@ class Thread : public std::enable_shared_from_this<Thread>, /// \param[in] stop_other_threads /// \b true if we will stop other threads while we single step this one. /// - /// \param[in] stop_vote + /// \param[in] report_stop_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// - /// \param[in] run_vote + /// \param[in] report_run_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// /// \param[in] frame_idx @@ -864,7 +864,7 @@ class Thread : public std::enable_shared_from_this<Thread>, /// plan could not be queued. virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, - bool stop_other_threads, Vote stop_vote, Vote run_vote, + bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, uint32_t frame_idx, Status &status, bool continue_to_next_branch = false); /// Gets the plan used to step through the code that steps from a function diff --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h index caa6c5fe63aa..30e81f6e3050 100644 --- a/lldb/include/lldb/Target/ThreadPlan.h +++ b/lldb/include/lldb/Target/ThreadPlan.h @@ -260,8 +260,8 @@ namespace lldb_private { // One other little detail here, sometimes a plan will push another plan onto // the plan stack to do some part of the first plan's job, and it would be // convenient to tell that plan how it should respond to ShouldReportStop. -// You can do that by setting the stop_vote in the child plan when you create -// it. +// You can do that by setting the report_stop_vote in the child plan when you +// create it. // // Suppressing the initial eStateRunning event: // @@ -275,8 +275,9 @@ namespace lldb_private { // eVoteNo from ShouldReportStop, to force a running event to be reported // return eVoteYes, in general though you should return eVoteNoOpinion which // will allow the ThreadList to figure out the right thing to do. The -// run_vote argument to the constructor works like stop_vote, and is a way for -// a plan to instruct a sub-plan on how to respond to ShouldReportStop. +// report_run_vote argument to the constructor works like report_stop_vote, and +// is a way for a plan to instruct a sub-plan on how to respond to +// ShouldReportStop. class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>, public UserID { @@ -472,7 +473,7 @@ class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>, protected: // Constructors and Destructors ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, - Vote stop_vote, Vote run_vote); + Vote report_stop_vote, Vote report_run_vote); // Classes that inherit from ThreadPlan can see and modify these @@ -515,8 +516,8 @@ class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>, Status m_status; Process &m_process; lldb::tid_t m_tid; - Vote m_stop_vote; - Vote m_run_vote; + Vote m_report_stop_vote; + Vote m_report_run_vote; bool m_takes_iteration_count; bool m_could_not_resolve_hw_bp; int32_t m_iteration_count = 1; diff --git a/lldb/include/lldb/Target/ThreadPlanStepInstruction.h b/lldb/include/lldb/Target/ThreadPlanStepInstruction.h index 760bc4886faa..52a5a2efc0a4 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepInstruction.h +++ b/lldb/include/lldb/Target/ThreadPlanStepInstruction.h @@ -18,7 +18,7 @@ namespace lldb_private { class ThreadPlanStepInstruction : public ThreadPlan { public: ThreadPlanStepInstruction(Thread &thread, bool step_over, bool stop_others, - Vote stop_vote, Vote run_vote); + Vote report_stop_vote, Vote report_run_vote); ~ThreadPlanStepInstruction() override; diff --git a/lldb/include/lldb/Target/ThreadPlanStepOut.h b/lldb/include/lldb/Target/ThreadPlanStepOut.h index 5c39232fd2e8..b1d8769f7c54 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepOut.h +++ b/lldb/include/lldb/Target/ThreadPlanStepOut.h @@ -18,8 +18,8 @@ namespace lldb_private { class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere { public: ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context, - bool first_insn, bool stop_others, Vote stop_vote, - Vote run_vote, uint32_t frame_idx, + 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); @@ -76,8 +76,9 @@ class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere { friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, - bool stop_others, Vote stop_vote, Vote run_vote, uint32_t frame_idx, - Status &status, LazyBool step_out_avoids_code_without_debug_info); + bool stop_others, Vote report_stop_vote, Vote report_run_vote, + uint32_t frame_idx, Status &status, + LazyBool step_out_avoids_code_without_debug_info); void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info); // Need an appropriate marker for the current stack so we can tell step out diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index a645f1be5b3c..de0ffa7ddd5d 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -3374,14 +3374,14 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) { should_resume = !m_thread_list.ShouldStop(event_ptr); if (was_restarted || should_resume || m_resume_requested) { - Vote stop_vote = m_thread_list.ShouldReportStop(event_ptr); + Vote report_stop_vote = m_thread_list.ShouldReportStop(event_ptr); LLDB_LOGF(log, "Process::ShouldBroadcastEvent: should_resume: %i state: " - "%s was_restarted: %i stop_vote: %d.", + "%s was_restarted: %i report_stop_vote: %d.", should_resume, StateAsCString(state), was_restarted, - stop_vote); + report_stop_vote); - switch (stop_vote) { + switch (report_stop_vote) { case eVoteYes: return_value = true; break; diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 6cbad2376201..6670caa54392 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1306,11 +1306,12 @@ ThreadPlanSP Thread::QueueThreadPlanForStepInRange( ThreadPlanSP Thread::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) { + 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) { ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut( - *this, addr_context, first_insn, stop_other_threads, stop_vote, run_vote, - frame_idx, step_out_avoids_code_without_debug_info)); + *this, addr_context, first_insn, stop_other_threads, report_stop_vote, + report_run_vote, frame_idx, step_out_avoids_code_without_debug_info)); status = QueueThreadPlan(thread_plan_sp, abort_other_plans); return thread_plan_sp; @@ -1318,13 +1319,14 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOut( ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop( 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, bool continue_to_next_branch) { + bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote, + uint32_t frame_idx, Status &status, bool continue_to_next_branch) { 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, stop_vote, run_vote, - frame_idx, eLazyBoolNo, continue_to_next_branch, calculate_return_value)); + *this, addr_context, first_insn, stop_other_threads, report_stop_vote, + report_run_vote, frame_idx, eLazyBoolNo, continue_to_next_branch, + calculate_return_value)); ThreadPlanStepOut *new_plan = static_cast<ThreadPlanStepOut *>(thread_plan_sp.get()); diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp index 84fd6b2107b6..6b55f3912d11 100644 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -20,9 +20,9 @@ using namespace lldb_private; // ThreadPlan constructor ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, - Vote stop_vote, Vote run_vote) + Vote report_stop_vote, Vote report_run_vote) : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()), - m_stop_vote(stop_vote), m_run_vote(run_vote), + m_report_stop_vote(report_stop_vote), m_report_run_vote(report_run_vote), m_takes_iteration_count(false), m_could_not_resolve_hw_bp(false), m_thread(&thread), m_kind(kind), m_name(name), m_plan_complete_mutex(), m_cached_plan_explains_stop(eLazyBoolCalculate), m_plan_complete(false), @@ -78,7 +78,7 @@ bool ThreadPlan::MischiefManaged() { Vote ThreadPlan::ShouldReportStop(Event *event_ptr) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); - if (m_stop_vote == eVoteNoOpinion) { + if (m_report_stop_vote == eVoteNoOpinion) { ThreadPlan *prev_plan = GetPreviousPlan(); if (prev_plan) { Vote prev_vote = prev_plan->ShouldReportStop(event_ptr); @@ -86,17 +86,17 @@ Vote ThreadPlan::ShouldReportStop(Event *event_ptr) { return prev_vote; } } - LLDB_LOG(log, "Returning vote: {0}", m_stop_vote); - return m_stop_vote; + LLDB_LOG(log, "Returning vote: {0}", m_report_stop_vote); + return m_report_stop_vote; } Vote ThreadPlan::ShouldReportRun(Event *event_ptr) { - if (m_run_vote == eVoteNoOpinion) { + if (m_report_run_vote == eVoteNoOpinion) { ThreadPlan *prev_plan = GetPreviousPlan(); if (prev_plan) return prev_plan->ShouldReportRun(event_ptr); } - return m_run_vote; + return m_report_run_vote; } void ThreadPlan::ClearThreadCache() { m_thread = nullptr; } diff --git a/lldb/source/Target/ThreadPlanBase.cpp b/lldb/source/Target/ThreadPlanBase.cpp index 650393d678e8..c5b128ae8ba5 100644 --- a/lldb/source/Target/ThreadPlanBase.cpp +++ b/lldb/source/Target/ThreadPlanBase.cpp @@ -70,8 +70,8 @@ Vote ThreadPlanBase::ShouldReportStop(Event *event_ptr) { } bool ThreadPlanBase::ShouldStop(Event *event_ptr) { - m_stop_vote = eVoteYes; - m_run_vote = eVoteYes; + m_report_stop_vote = eVoteYes; + m_report_run_vote = eVoteYes; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); @@ -82,8 +82,8 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) { case eStopReasonInvalid: case eStopReasonNone: // This - m_run_vote = eVoteNoOpinion; - m_stop_vote = eVoteNo; + m_report_run_vote = eVoteNoOpinion; + m_report_stop_vote = eVoteNo; return false; case eStopReasonBreakpoint: @@ -106,11 +106,11 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) { // with "restarted" so the UI will know to wait and expect the consequent // "running". if (stop_info_sp->ShouldNotify(event_ptr)) { - m_stop_vote = eVoteYes; - m_run_vote = eVoteYes; + m_report_stop_vote = eVoteYes; + m_report_run_vote = eVoteYes; } else { - m_stop_vote = eVoteNo; - m_run_vote = eVoteNo; + m_report_stop_vote = eVoteNo; + m_report_run_vote = eVoteNo; } return false; @@ -156,9 +156,9 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) { // We're not going to stop, but while we are here, let's figure out // whether to report this. if (stop_info_sp->ShouldNotify(event_ptr)) - m_stop_vote = eVoteYes; + m_report_stop_vote = eVoteYes; else - m_stop_vote = eVoteNo; + m_report_stop_vote = eVoteNo; } return false; @@ -167,8 +167,8 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) { } } else { - m_run_vote = eVoteNoOpinion; - m_stop_vote = eVoteNo; + m_report_run_vote = eVoteNoOpinion; + m_report_stop_vote = eVoteNo; } // If there's no explicit reason to stop, then we will continue. @@ -185,8 +185,8 @@ bool ThreadPlanBase::DoWillResume(lldb::StateType resume_state, bool current_plan) { // Reset these to the default values so we don't set them wrong, then not get // asked for a while, then return the wrong answer. - m_run_vote = eVoteNoOpinion; - m_stop_vote = eVoteNo; + m_report_run_vote = eVoteNoOpinion; + m_report_stop_vote = eVoteNo; return true; } diff --git a/lldb/source/Target/ThreadPlanStepInstruction.cpp b/lldb/source/Target/ThreadPlanStepInstruction.cpp index c0da735c44b6..e34e41e8bce8 100644 --- a/lldb/source/Target/ThreadPlanStepInstruction.cpp +++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp @@ -23,10 +23,11 @@ using namespace lldb_private; ThreadPlanStepInstruction::ThreadPlanStepInstruction(Thread &thread, bool step_over, bool stop_other_threads, - Vote stop_vote, - Vote run_vote) + Vote report_stop_vote, + Vote report_run_vote) : ThreadPlan(ThreadPlan::eKindStepInstruction, - "Step over single instruction", thread, stop_vote, run_vote), + "Step over single instruction", thread, report_stop_vote, + report_run_vote), m_instruction_addr(0), m_stop_other_threads(stop_other_threads), m_step_over(step_over) { m_takes_iteration_count = true; diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 9f0749c0fdb3..86ccac2ec499 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -33,11 +33,11 @@ uint32_t ThreadPlanStepOut::s_default_flag_values = 0; // ThreadPlanStepOut: Step out of the current frame ThreadPlanStepOut::ThreadPlanStepOut( Thread &thread, SymbolContext *context, bool first_insn, bool stop_others, - Vote stop_vote, Vote run_vote, uint32_t frame_idx, + 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, bool gather_return_value) - : ThreadPlan(ThreadPlan::eKindStepOut, "Step out", thread, stop_vote, - run_vote), + : ThreadPlan(ThreadPlan::eKindStepOut, "Step out", thread, report_stop_vote, + report_run_vote), ThreadPlanShouldStopHere(this), m_step_from_insn(LLDB_INVALID_ADDRESS), m_return_bp_id(LLDB_INVALID_BREAK_ID), m_return_addr(LLDB_INVALID_ADDRESS), m_stop_others(stop_others), _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits