quinnp created this revision.
quinnp requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

[NFC] As part of using inclusive language within the llvm project, this patch
renames master plan to primary plan in lldb.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113019

Files:
  lldb/docs/use/python-reference.rst
  lldb/include/lldb/Target/Thread.h
  lldb/include/lldb/Target/ThreadPlan.h
  lldb/include/lldb/Target/ThreadPlanStack.h
  lldb/source/API/SBThread.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Expression/FunctionCaller.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/StopInfo.cpp
  lldb/source/Target/Thread.cpp
  lldb/source/Target/ThreadPlan.cpp
  lldb/source/Target/ThreadPlanBase.cpp
  lldb/source/Target/ThreadPlanCallFunction.cpp
  lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
  lldb/source/Target/ThreadPlanCallUserExpression.cpp
  lldb/source/Target/ThreadPlanPython.cpp
  lldb/source/Target/ThreadPlanStack.cpp

Index: lldb/source/Target/ThreadPlanStack.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStack.cpp
+++ lldb/source/Target/ThreadPlanStack.cpp
@@ -213,35 +213,35 @@
   return;
 }
 
-void ThreadPlanStack::DiscardConsultingMasterPlans() {
+void ThreadPlanStack::DiscardConsultingPrimaryPlans() {
   std::lock_guard<std::recursive_mutex> guard(m_stack_mutex);
   while (true) {
-    int master_plan_idx;
+    int primary_plan_idx;
     bool discard = true;
 
-    // Find the first master plan, see if it wants discarding, and if yes
+    // Find the first primary plan, see if it wants discarding, and if yes
     // discard up to it.
-    for (master_plan_idx = m_plans.size() - 1; master_plan_idx >= 0;
-         master_plan_idx--) {
-      if (m_plans[master_plan_idx]->IsMasterPlan()) {
-        discard = m_plans[master_plan_idx]->OkayToDiscard();
+    for (primary_plan_idx = m_plans.size() - 1; primary_plan_idx >= 0;
+         primary_plan_idx--) {
+      if (m_plans[primary_plan_idx]->IsPrimaryPlan()) {
+        discard = m_plans[primary_plan_idx]->OkayToDiscard();
         break;
       }
     }
 
-    // If the master plan doesn't want to get discarded, then we're done.
+    // If the primary plan doesn't want to get discarded, then we're done.
     if (!discard)
       return;
 
     // First pop all the dependent plans:
-    for (int i = m_plans.size() - 1; i > master_plan_idx; i--) {
+    for (int i = m_plans.size() - 1; i > primary_plan_idx; i--) {
       DiscardPlan();
     }
 
-    // Now discard the master plan itself.
+    // Now discard the primary plan itself.
     // The bottom-most plan never gets discarded.  "OkayToDiscard" for it
     // means discard it's dependent plans, but not it...
-    if (master_plan_idx > 0) {
+    if (primary_plan_idx > 0) {
       DiscardPlan();
     }
   }
Index: lldb/source/Target/ThreadPlanPython.cpp
===================================================================
--- lldb/source/Target/ThreadPlanPython.cpp
+++ lldb/source/Target/ThreadPlanPython.cpp
@@ -31,7 +31,7 @@
                  eVoteNoOpinion, eVoteNoOpinion),
       m_class_name(class_name), m_args_data(args_data), m_did_push(false),
       m_stop_others(false) {
-  SetIsMasterPlan(true);
+  SetIsPrimaryPlan(true);
   SetOkayToDiscard(true);
   SetPrivate(false);
 }
Index: lldb/source/Target/ThreadPlanCallUserExpression.cpp
===================================================================
--- lldb/source/Target/ThreadPlanCallUserExpression.cpp
+++ lldb/source/Target/ThreadPlanCallUserExpression.cpp
@@ -39,7 +39,7 @@
       m_user_expression_sp(user_expression_sp) {
   // User expressions are generally "User generated" so we should set them up
   // to stop when done.
-  SetIsMasterPlan(true);
+  SetIsPrimaryPlan(true);
   SetOkayToDiscard(false);
 }
 
Index: lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
===================================================================
--- lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
+++ lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
@@ -18,7 +18,7 @@
                  ),
       m_callback(callback) {
   // We are not a user-generated plan.
-  SetIsMasterPlan(false);
+  SetIsPrimaryPlan(false);
 }
 
 void ThreadPlanCallOnFunctionExit::DidPush() {
Index: lldb/source/Target/ThreadPlanCallFunction.cpp
===================================================================
--- lldb/source/Target/ThreadPlanCallFunction.cpp
+++ lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -33,7 +33,7 @@
 bool ThreadPlanCallFunction::ConstructorSetup(
     Thread &thread, ABI *&abi, lldb::addr_t &start_load_addr,
     lldb::addr_t &function_load_addr) {
-  SetIsMasterPlan(true);
+  SetIsPrimaryPlan(true);
   SetOkayToDiscard(false);
   SetPrivate(true);
 
Index: lldb/source/Target/ThreadPlanBase.cpp
===================================================================
--- lldb/source/Target/ThreadPlanBase.cpp
+++ lldb/source/Target/ThreadPlanBase.cpp
@@ -40,7 +40,7 @@
 #endif
   new_tracer_sp->EnableTracing(thread.GetTraceEnabledState());
   SetThreadPlanTracer(new_tracer_sp);
-  SetIsMasterPlan(true);
+  SetIsPrimaryPlan(true);
 }
 
 ThreadPlanBase::~ThreadPlanBase() = default;
@@ -90,7 +90,7 @@
     case eStopReasonWatchpoint:
       if (stop_info_sp->ShouldStopSynchronous(event_ptr)) {
         // If we are going to stop for a breakpoint, then unship the other
-        // plans at this point.  Don't force the discard, however, so Master
+        // plans at this point.  Don't force the discard, however, so Primary
         // plans can stay in place if they want to.
         LLDB_LOGF(
             log,
Index: lldb/source/Target/ThreadPlan.cpp
===================================================================
--- lldb/source/Target/ThreadPlan.cpp
+++ lldb/source/Target/ThreadPlan.cpp
@@ -26,7 +26,7 @@
       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),
-      m_plan_private(false), m_okay_to_discard(true), m_is_master_plan(false),
+      m_plan_private(false), m_okay_to_discard(true), m_is_primary_plan(false),
       m_plan_succeeded(true) {
   SetID(GetNextID());
 }
@@ -152,7 +152,7 @@
 void ThreadPlan::DidPop() {}
 
 bool ThreadPlan::OkayToDiscard() {
-  return IsMasterPlan() ? m_okay_to_discard : true;
+  return IsPrimaryPlan() ? m_okay_to_discard : true;
 }
 
 lldb::StateType ThreadPlan::RunState() {
Index: lldb/source/Target/Thread.cpp
===================================================================
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -844,7 +844,7 @@
             // we're done, otherwise we forward this to the next plan in the
             // stack below.
             done_processing_current_plan =
-                (plan_ptr->IsMasterPlan() && !plan_ptr->OkayToDiscard());
+                (plan_ptr->IsPrimaryPlan() && !plan_ptr->OkayToDiscard());
           } else
             done_processing_current_plan = true;
 
@@ -882,11 +882,11 @@
                       current_plan->GetName());
           }
 
-          // If a Master Plan wants to stop, we let it. Otherwise, see if the
+          // If a Primary Plan wants to stop, we let it. Otherwise, see if the
           // plan's parent wants to stop.
 
           PopPlan();
-          if (should_stop && current_plan->IsMasterPlan() &&
+          if (should_stop && current_plan->IsPrimaryPlan() &&
               !current_plan->OkayToDiscard()) {
             break;
           }
@@ -905,7 +905,7 @@
       should_stop = false;
   }
 
-  // One other potential problem is that we set up a master plan, then stop in
+  // One other potential problem is that we set up a primary plan, then stop in
   // before it is complete - for instance by hitting a breakpoint during a
   // step-over - then do some step/finish/etc operations that wind up past the
   // end point condition of the initial plan.  We don't want to strand the
@@ -1214,7 +1214,7 @@
     GetPlans().DiscardAllPlans();
     return;
   }
-  GetPlans().DiscardConsultingMasterPlans();
+  GetPlans().DiscardConsultingPrimaryPlans();
 }
 
 Status Thread::UnwindInnermostExpression() {
@@ -1914,7 +1914,7 @@
           false, abort_other_plans, run_mode, error);
     }
 
-    new_plan_sp->SetIsMasterPlan(true);
+    new_plan_sp->SetIsPrimaryPlan(true);
     new_plan_sp->SetOkayToDiscard(false);
 
     // Why do we need to set the current thread by ID here???
@@ -1947,7 +1947,7 @@
           true, abort_other_plans, run_mode, error);
     }
 
-    new_plan_sp->SetIsMasterPlan(true);
+    new_plan_sp->SetIsPrimaryPlan(true);
     new_plan_sp->SetOkayToDiscard(false);
 
     // Why do we need to set the current thread by ID here???
@@ -1971,7 +1971,7 @@
         abort_other_plans, nullptr, first_instruction, stop_other_threads,
         eVoteYes, eVoteNoOpinion, 0, error));
 
-    new_plan_sp->SetIsMasterPlan(true);
+    new_plan_sp->SetIsPrimaryPlan(true);
     new_plan_sp->SetOkayToDiscard(false);
 
     // Why do we need to set the current thread by ID here???
Index: lldb/source/Target/StopInfo.cpp
===================================================================
--- lldb/source/Target/StopInfo.cpp
+++ lldb/source/Target/StopInfo.cpp
@@ -764,7 +764,7 @@
                         true,  // stop_other_threads
                         new_plan_status));
                 if (new_plan_sp && new_plan_status.Success()) {
-                  new_plan_sp->SetIsMasterPlan(true);
+                  new_plan_sp->SetIsPrimaryPlan(true);
                   new_plan_sp->SetOkayToDiscard(false);
                   new_plan_sp->SetPrivate(true);
                 }
Index: lldb/source/Target/Process.cpp
===================================================================
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -4526,7 +4526,7 @@
 void Process::SettingsTerminate() { Thread::SettingsTerminate(); }
 
 namespace {
-// RestorePlanState is used to record the "is private", "is master" and "okay
+// RestorePlanState is used to record the "is private", "is primary" and "okay
 // to discard" fields of the plan we are running, and reset it on Clean or on
 // destruction. It will only reset the state once, so you can call Clean and
 // then monkey with the state and it won't get reset on you again.
@@ -4537,7 +4537,7 @@
       : m_thread_plan_sp(thread_plan_sp), m_already_reset(false) {
     if (m_thread_plan_sp) {
       m_private = m_thread_plan_sp->GetPrivate();
-      m_is_master = m_thread_plan_sp->IsMasterPlan();
+      m_is_primary = m_thread_plan_sp->IsPrimaryPlan();
       m_okay_to_discard = m_thread_plan_sp->OkayToDiscard();
     }
   }
@@ -4548,7 +4548,7 @@
     if (!m_already_reset && m_thread_plan_sp) {
       m_already_reset = true;
       m_thread_plan_sp->SetPrivate(m_private);
-      m_thread_plan_sp->SetIsMasterPlan(m_is_master);
+      m_thread_plan_sp->SetIsPrimaryPlan(m_is_primary);
       m_thread_plan_sp->SetOkayToDiscard(m_okay_to_discard);
     }
   }
@@ -4557,7 +4557,7 @@
   lldb::ThreadPlanSP m_thread_plan_sp;
   bool m_already_reset;
   bool m_private;
-  bool m_is_master;
+  bool m_is_primary;
   bool m_okay_to_discard;
 };
 } // anonymous namespace
@@ -4708,11 +4708,11 @@
 
   thread_plan_sp->SetPrivate(false);
 
-  // The plans run with RunThreadPlan also need to be terminal master plans or
+  // The plans run with RunThreadPlan also need to be terminal primary plans or
   // when they are done we will end up asking the plan above us whether we
   // should stop, which may give the wrong answer.
 
-  thread_plan_sp->SetIsMasterPlan(true);
+  thread_plan_sp->SetIsPrimaryPlan(true);
   thread_plan_sp->SetOkayToDiscard(false);
 
   // If we are running some utility expression for LLDB, we now have to mark
Index: lldb/source/Expression/FunctionCaller.cpp
===================================================================
--- lldb/source/Expression/FunctionCaller.cpp
+++ lldb/source/Expression/FunctionCaller.cpp
@@ -254,7 +254,7 @@
 
   lldb::ThreadPlanSP new_plan_sp(new ThreadPlanCallFunction(
       *thread, wrapper_address, CompilerType(), args, options));
-  new_plan_sp->SetIsMasterPlan(true);
+  new_plan_sp->SetIsPrimaryPlan(true);
   new_plan_sp->SetOkayToDiscard(false);
   return new_plan_sp;
 }
Index: lldb/source/Commands/CommandObjectThread.cpp
===================================================================
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -526,12 +526,12 @@
       return false;
     }
 
-    // If we got a new plan, then set it to be a master plan (User level Plans
-    // should be master plans so that they can be interruptible).  Then resume
+    // If we got a new plan, then set it to be a primary plan (User level Plans
+    // should be primary plans so that they can be interruptible).  Then resume
     // the process.
 
     if (new_plan_sp) {
-      new_plan_sp->SetIsMasterPlan(true);
+      new_plan_sp->SetIsPrimaryPlan(true);
       new_plan_sp->SetOkayToDiscard(false);
 
       if (m_options.m_step_count > 1) {
@@ -1021,11 +1021,11 @@
             abort_other_plans, &address_list.front(), address_list.size(),
             m_options.m_stop_others, m_options.m_frame_idx, new_plan_status);
         if (new_plan_sp) {
-          // User level plans should be master plans so they can be interrupted
+          // User level plans should be primary plans so they can be interrupted
           // (e.g. by hitting a breakpoint) and other plans executed by the
           // user (stepping around the breakpoint) and then a "continue" will
           // resume the original plan.
-          new_plan_sp->SetIsMasterPlan(true);
+          new_plan_sp->SetIsPrimaryPlan(true);
           new_plan_sp->SetOkayToDiscard(false);
         } else {
           result.SetError(new_plan_status);
Index: lldb/source/API/SBThread.cpp
===================================================================
--- lldb/source/API/SBThread.cpp
+++ lldb/source/API/SBThread.cpp
@@ -513,10 +513,10 @@
     return sb_error;
   }
 
-  // User level plans should be Master Plans so they can be interrupted, other
+  // User level plans should be Primary Plans so they can be interrupted, other
   // plans executed, and then a "continue" will resume the plan.
   if (new_plan != nullptr) {
-    new_plan->SetIsMasterPlan(true);
+    new_plan->SetIsPrimaryPlan(true);
     new_plan->SetOkayToDiscard(false);
   }
 
Index: lldb/include/lldb/Target/ThreadPlanStack.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStack.h
+++ lldb/include/lldb/Target/ThreadPlanStack.h
@@ -60,7 +60,7 @@
 
   void DiscardAllPlans();
 
-  void DiscardConsultingMasterPlans();
+  void DiscardConsultingPrimaryPlans();
 
   lldb::ThreadPlanSP GetCurrentPlan() const;
 
Index: lldb/include/lldb/Target/ThreadPlan.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlan.h
+++ lldb/include/lldb/Target/ThreadPlan.h
@@ -144,38 +144,38 @@
 //  implement DoPlanExplainsStop, the result is cached in PlanExplainsStop so
 //  the DoPlanExplainsStop itself will only get called once per stop.
 //
-//  Master plans:
+//  Primary plans:
 //
 //  In the normal case, when we decide to stop, we will  collapse the plan
 //  stack up to the point of the plan that understood the stop reason.
 //  However, if a plan wishes to stay on the stack after an event it didn't
-//  directly handle it can designate itself a "Master" plan by responding true
-//  to IsMasterPlan, and then if it wants not to be discarded, it can return
+//  directly handle it can designate itself a "Primary" plan by responding true
+//  to IsPrimaryPlan, and then if it wants not to be discarded, it can return
 //  false to OkayToDiscard, and it and all its dependent plans will be
 //  preserved when we resume execution.
 //
-//  The other effect of being a master plan is that when the Master plan is
+//  The other effect of being a primary plan is that when the Primary plan is
 //  done , if it has set "OkayToDiscard" to false, then it will be popped &
 //  execution will stop and return to the user.  Remember that if OkayToDiscard
 //  is false, the plan will be popped and control will be given to the next
 //  plan above it on the stack  So setting OkayToDiscard to false means the
-//  user will regain control when the MasterPlan is completed.
+//  user will regain control when the PrimaryPlan is completed.
 //
 //  Between these two controls this allows things like: a
-//  MasterPlan/DontDiscard Step Over to hit a breakpoint, stop and return
+//  PrimaryPlan/DontDiscard Step Over to hit a breakpoint, stop and return
 //  control to the user, but then when the user continues, the step out
 //  succeeds.  Even more tricky, when the breakpoint is hit, the user can
 //  continue to step in/step over/etc, and finally when they continue, they
 //  will finish up the Step Over.
 //
-//  FIXME: MasterPlan & OkayToDiscard aren't really orthogonal.  MasterPlan
+//  FIXME: PrimaryPlan & OkayToDiscard aren't really orthogonal.  PrimaryPlan
 //  designation means that this plan controls it's fate and the fate of plans
-//  below it.  OkayToDiscard tells whether the MasterPlan wants to stay on the
-//  stack.  I originally thought "MasterPlan-ness" would need to be a fixed
+//  below it.  OkayToDiscard tells whether the PrimaryPlan wants to stay on the
+//  stack.  I originally thought "PrimaryPlan-ness" would need to be a fixed
 //  characteristic of a ThreadPlan, in which case you needed the extra control.
 //  But that doesn't seem to be true.  So we should be able to convert to only
-//  MasterPlan status to mean the current "MasterPlan/DontDiscard".  Then no
-//  plans would be MasterPlans by default, and you would set the ones you
+//  PrimaryPlan status to mean the current "PrimaryPlan/DontDiscard".  Then no
+//  plans would be PrimaryPlans by default, and you would set the ones you
 //  wanted to be "user level" in this way.
 //
 //
@@ -224,9 +224,9 @@
 //
 //  Cleaning up the plan stack:
 //
-//  One of the complications of MasterPlans is that you may get past the limits
+//  One of the complications of PrimaryPlans is that you may get past the limits
 //  of a plan without triggering it to clean itself up.  For instance, if you
-//  are doing a MasterPlan StepOver, and hit a breakpoint in a called function,
+//  are doing a PrimaryPlan StepOver, and hit a breakpoint in a called function,
 //  then step over enough times to step out of the initial StepOver range, each
 //  of the step overs will explain the stop & take themselves off the stack,
 //  but control would never be returned to the original StepOver.  Eventually,
@@ -386,11 +386,11 @@
 
   virtual bool WillStop() = 0;
 
-  bool IsMasterPlan() { return m_is_master_plan; }
+  bool IsPrimaryPlan() { return m_is_primary_plan; }
 
-  bool SetIsMasterPlan(bool value) {
-    bool old_value = m_is_master_plan;
-    m_is_master_plan = value;
+  bool SetIsPrimaryPlan(bool value) {
+    bool old_value = m_is_primary_plan;
+    m_is_primary_plan = value;
     return old_value;
   }
 
@@ -490,12 +490,12 @@
   virtual bool DoPlanExplainsStop(Event *event_ptr) = 0;
 
   // This pushes a plan onto the plan stack of the current plan's thread.
-  // Also sets the plans to private and not master plans.  A plan pushed by
+  // Also sets the plans to private and not primary plans.  A plan pushed by
   // another thread plan is never either of the above.
   void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) {
     GetThread().PushPlan(thread_plan_sp);
     thread_plan_sp->SetPrivate(true);
-    thread_plan_sp->SetIsMasterPlan(false);
+    thread_plan_sp->SetIsPrimaryPlan(false);
   }
 
   // This gets the previous plan to the current plan (for forwarding requests).
@@ -546,7 +546,7 @@
   bool m_plan_complete;
   bool m_plan_private;
   bool m_okay_to_discard;
-  bool m_is_master_plan;
+  bool m_is_primary_plan;
   bool m_plan_succeeded;
 
   lldb::ThreadPlanTracerSP m_tracer_sp;
Index: lldb/include/lldb/Target/Thread.h
===================================================================
--- lldb/include/lldb/Target/Thread.h
+++ lldb/include/lldb/Target/Thread.h
@@ -1015,7 +1015,7 @@
 
   /// Discards the plans queued on the plan stack of the current thread.  This
   /// is
-  /// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call.
+  /// arbitrated by the "Primary" ThreadPlans, using the "OkayToDiscard" call.
   //  But if \a force is true, all thread plans are discarded.
   void DiscardThreadPlans(bool force);
 
Index: lldb/docs/use/python-reference.rst
===================================================================
--- lldb/docs/use/python-reference.rst
+++ lldb/docs/use/python-reference.rst
@@ -442,7 +442,7 @@
 https://github.com/llvm/llvm-project/blob/main/lldb/include/lldb/Target/ThreadPlan.h
 
 If you are reading those comments it is useful to know that scripted thread
-plans are set to be "MasterPlans", and not "OkayToDiscard".
+plans are set to be "PrimaryPlans", and not "OkayToDiscard".
 
 To implement a scripted step, you define a python class that has the following
 methods:
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to