Guard against 'current_directory == NULL' on gdb_abspath (PR gdb/23613)
[deliverable/binutils-gdb.git] / gdb / gdbserver / inferiors.c
index be3f3ef3c1daf8544aa84dba66b55ddca88f1044..e35186bda14eb90a91fe897d59aa1f5199ca798f 100644 (file)
@@ -1,5 +1,5 @@
 /* Inferior process information for the remote server for GDB.
-   Copyright (C) 2002-2017 Free Software Foundation, Inc.
+   Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
    Contributed by MontaVista Software.
 
@@ -30,53 +30,6 @@ struct thread_info *current_thread;
 /* The current working directory used to start the inferior.  */
 static const char *current_inferior_cwd = NULL;
 
-thread_info *
-find_inferior (std::list<thread_info *> *thread_list,
-              int (*func) (thread_info *, void *),
-              void *arg)
-{
-  gdb_assert (thread_list == &all_threads);
-
-  return find_thread ([&] (thread_info *thread) {
-    return func (thread, arg);
-  });
-}
-
-thread_info *
-find_inferior_in_random (std::list<thread_info *> *thread_list,
-                        int (*func) (thread_info *, void *),
-                        void *arg)
-{
-  gdb_assert (thread_list == &all_threads);
-
-  return find_thread_in_random ([&] (thread_info *thread) {
-    return func (thread, arg);
-  });
-}
-
-void
-for_each_inferior (std::list<thread_info *> *thread_list,
-                  void (*action) (thread_info *))
-{
-  gdb_assert (thread_list == &all_threads);
-
-  for_each_thread ([&] (thread_info *thread) {
-    action (thread);
-  });
-}
-
-void
-for_each_inferior_with_data (std::list<thread_info *> *thread_list,
-                            void (*action) (thread_info *, void *),
-                            void *data)
-{
-  gdb_assert (thread_list == &all_threads);
-
-  for_each_thread ([&] (thread_info *thread) {
-    action (thread, data);
-  });
-}
-
 struct thread_info *
 add_thread (ptid_t thread_id, void *target_data)
 {
@@ -175,7 +128,7 @@ set_thread_regcache_data (struct thread_info *thread, struct regcache *data)
 void
 clear_inferiors (void)
 {
-  for_each_inferior (&all_threads, free_one_thread);
+  for_each_thread (free_one_thread);
   all_threads.clear ();
 
   clear_dlls ();
@@ -260,19 +213,7 @@ current_process (void)
   return get_thread_process (current_thread);
 }
 
-static void
-do_restore_current_thread_cleanup (void *arg)
-{
-  current_thread = (struct thread_info *) arg;
-}
-
-struct cleanup *
-make_cleanup_restore_current_thread (void)
-{
-  return make_cleanup (do_restore_current_thread_cleanup, current_thread);
-}
-
-/* See common/common-gdbthread.h.  */
+/* See gdbsupport/common-gdbthread.h.  */
 
 void
 switch_to_thread (ptid_t ptid)
@@ -281,7 +222,7 @@ switch_to_thread (ptid_t ptid)
   current_thread = find_thread_ptid (ptid);
 }
 
-/* See common/common-inferior.h.  */
+/* See gdbsupport/common-inferior.h.  */
 
 const char *
 get_inferior_cwd ()
@@ -289,7 +230,7 @@ get_inferior_cwd ()
   return current_inferior_cwd;
 }
 
-/* See common/common-inferior.h.  */
+/* See gdbsupport/common-inferior.h.  */
 
 void
 set_inferior_cwd (const char *cwd)
This page took 0.02704 seconds and 4 git commands to generate.