[Lldb-commits] [lldb] 65d91b4 - [lldb] Minor refinements to ThreadPlan::RestoreThreadState (NFC)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 15 17:58:56 PST 2021


Author: Dave Lee
Date: 2021-02-15T17:57:13-08:00
New Revision: 65d91b40ae1d273586a8265d7cf598f0e56e17a3

URL: https://github.com/llvm/llvm-project/commit/65d91b40ae1d273586a8265d7cf598f0e56e17a3
DIFF: https://github.com/llvm/llvm-project/commit/65d91b40ae1d273586a8265d7cf598f0e56e17a3.diff

LOG: [lldb] Minor refinements to ThreadPlan::RestoreThreadState (NFC)

Correct `RestoreThreadState` to a `void` return type. Also, update the signature of its
callee, `Thread::RestoreThreadStateFromCheckpoint`, by updating it to a `void` return
type, and making it non-`virtual`.

Differential Revision: https://reviews.llvm.org/D96688

Added: 
    

Modified: 
    lldb/include/lldb/Target/Thread.h
    lldb/include/lldb/Target/ThreadPlan.h
    lldb/include/lldb/Target/ThreadPlanCallFunction.h
    lldb/source/Target/Thread.cpp
    lldb/source/Target/ThreadPlanCallFunction.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h
index 4b148063ec6e..04fa210fd4e4 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -1050,8 +1050,7 @@ class Thread : public std::enable_shared_from_this<Thread>,
   virtual bool
   RestoreRegisterStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
 
-  virtual bool
-  RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
+  void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
 
   void EnableTracer(bool value, bool single_step);
 

diff  --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h
index 17bbfc988f56..74d49ceb0e0a 100644
--- a/lldb/include/lldb/Target/ThreadPlan.h
+++ b/lldb/include/lldb/Target/ThreadPlan.h
@@ -464,10 +464,7 @@ class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>,
   // to restore the state when it is done.  This will do that job. This is
   // mostly useful for artificial plans like CallFunction plans.
 
-  virtual bool RestoreThreadState() {
-    // Nothing to do in general.
-    return true;
-  }
+  virtual void RestoreThreadState() {}
 
   virtual bool IsVirtualStep() { return false; }
 

diff  --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index 5b432e5e604a..8874c6c6c729 100644
--- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -90,7 +90,7 @@ class ThreadPlanCallFunction : public ThreadPlan {
 
   lldb::addr_t GetStopAddress() { return m_stop_address; }
 
-  bool RestoreThreadState() override;
+  void RestoreThreadState() override;
 
   void ThreadDestroyed() override { m_takedown_done = true; }
 

diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 660d5f8908b3..1fb19aea4fd9 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -530,7 +530,7 @@ bool Thread::RestoreRegisterStateFromCheckpoint(
   return false;
 }
 
-bool Thread::RestoreThreadStateFromCheckpoint(
+void Thread::RestoreThreadStateFromCheckpoint(
     ThreadStateCheckpoint &saved_state) {
   if (saved_state.stop_info_sp)
     saved_state.stop_info_sp->MakeStopInfoValid();
@@ -539,7 +539,6 @@ bool Thread::RestoreThreadStateFromCheckpoint(
       saved_state.current_inlined_depth);
   GetPlans().RestoreCompletedPlanCheckpoint(
       saved_state.m_completed_plan_checkpoint);
-  return true;
 }
 
 StateType Thread::GetState() const {

diff  --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index f525173f8a51..3699a507d058 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -454,8 +454,8 @@ void ThreadPlanCallFunction::SetStopOthers(bool new_value) {
   m_subplan_sp->SetStopOthers(new_value);
 }
 
-bool ThreadPlanCallFunction::RestoreThreadState() {
-  return GetThread().RestoreThreadStateFromCheckpoint(m_stored_thread_state);
+void ThreadPlanCallFunction::RestoreThreadState() {
+  GetThread().RestoreThreadStateFromCheckpoint(m_stored_thread_state);
 }
 
 void ThreadPlanCallFunction::SetReturnValue() {


        


More information about the lldb-commits mailing list