[RFC,3/3] gdb: remove inferior continuations

Message ID 2330c2b4329642ee66976b4b8d5ee8f1e4defc42.1713423838.git.tankut.baris.aktemur@intel.com
State New
Headers
Series Wait for inferior after attaching |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Aktemur, Tankut Baris April 18, 2024, 7:36 a.m. UTC
  Remove the continuation mechanism.  It is not used anymore.
---
 gdb/inf-loop.c |  5 -----
 gdb/inferior.c | 19 -------------------
 gdb/inferior.h | 11 -----------
 3 files changed, 35 deletions(-)
  

Patch

diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index 41e766095f0..3c31d0d2349 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -51,11 +51,6 @@  inferior_event_handler (enum inferior_event_type event_type)
 	    target_async (false);
 	}
 
-      /* Do all continuations associated with the whole inferior (not
-	 a particular thread).  */
-      if (inferior_ptid != null_ptid)
-	current_inferior ()->do_all_continuations ();
-
       /* When running a command list (from a user command, say), these
 	 are only run when the command list is all done.  */
       if (current_ui->async)
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 4e1d789d1ba..a42c79d6ce3 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -77,8 +77,6 @@  inferior::~inferior ()
      that target, leaving its reference count artificially high.  However,
      this is not critical as the dummy_target is a singleton.  */
   gdb_assert (m_target_stack.top ()->stratum () == dummy_stratum);
-
-  m_continuations.clear ();
 }
 
 inferior::inferior (int pid_)
@@ -184,23 +182,6 @@  inferior::set_arch (gdbarch *arch)
     registers_changed_ptid (proc_target, ptid_t (this->pid));
 }
 
-void
-inferior::add_continuation (std::function<void ()> &&cont)
-{
-  m_continuations.emplace_front (std::move (cont));
-}
-
-void
-inferior::do_all_continuations ()
-{
-  while (!m_continuations.empty ())
-    {
-      auto iter = m_continuations.begin ();
-      (*iter) ();
-      m_continuations.erase (iter);
-    }
-}
-
 /* Notify interpreters and observers that inferior INF was added.  */
 
 static void
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 7be28423aeb..2b2905b7576 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -499,14 +499,6 @@  class inferior : public refcounted_object,
   /* Delete all threads in the thread list, silently.  */
   void clear_thread_list ();
 
-  /* Continuations-related methods.  A continuation is an std::function
-     to be called to finish the execution of a command when running
-     GDB asynchronously.  A continuation is executed after any thread
-     of this inferior stops.  Continuations are used by the attach
-     command and the remote target when a new inferior is detected.  */
-  void add_continuation (std::function<void ()> &&cont);
-  void do_all_continuations ();
-
   /* Set/get file name for default use for standard in/out in the inferior.
 
      On Unix systems, we try to make TERMINAL_NAME the inferior's controlling
@@ -672,9 +664,6 @@  class inferior : public refcounted_object,
   /* The name of terminal device to use for I/O.  */
   std::string m_terminal;
 
-  /* The list of continuations.  */
-  std::list<std::function<void ()>> m_continuations;
-
   /* The arguments string to use when running.  */
   std::string m_args;