import gdb-1999-06-14 snapshot
[deliverable/binutils-gdb.git] / gdb / thread.c
index aff7ef339aae789fbbb862dd9a1959103bf9b387..516bca3beb8f16902d5f2deb6da2af4aa0f8cdbe 100644 (file)
@@ -73,113 +73,25 @@ struct thread_info
 
 };
 
-static struct target_thread_vector *target_thread_functions;
-
-int
-target_find_new_threads ()
-{
-  int retval = 0;
-  if (target_thread_functions &&
-      target_thread_functions->find_new_threads)
-    retval = (*(target_thread_functions->find_new_threads)) ();
-  return retval;               /* no support */
-}
-
-
-int
-target_get_thread_info PARAMS ((
-                                gdb_threadref * ref,
-                                int selection,         /* FIXME: Selection */
-                                struct gdb_ext_thread_info * info));
-
-int
-target_get_thread_info (ref, selection, info)
-
-     gdb_threadref *ref;
-     int selection;
-    /* FIXME: Selection */
-     struct gdb_ext_thread_info *info;
-
-{
-  int retval = 0;
-  if (target_thread_functions
-      && target_thread_functions->get_thread_info)
-    retval = (*(target_thread_functions->get_thread_info)) (ref, selection, info);
-  return retval;
-}
-
-
-/* It is possible that these bind and unbinf functions implement a
-   stack the interface allows it, but its not implemented that way
- */
-
-
-void
-bind_target_thread_vector (vec)
-     struct target_thread_vector *vec;
-{
-  target_thread_functions = vec;
-}
-
 /* Prototypes for exported functions. */
 
-struct target_thread_vector *
-unbind_target_thread_vector ()
-{
-  struct target_thread_vector *retval;
-  retval = target_thread_functions;
-  target_thread_functions = 0;
-  return retval;
-}                              /* unbind_target_thread-vector */
-
 void _initialize_thread PARAMS ((void));
 
-
 /* Prototypes for local functions. */
-/* If the host has threads, the host machine definition may
-   set this macro. But, for remote thread debugging, it gets more
-   complex and setting macros does not bind to the various target
-   dependent methods well. So, we use the vector target_thread_functions
-   */
-#if !defined(FIND_NEW_THREADS)
-#define FIND_NEW_THREADS target_find_new_threads
-#endif  
-                          
+
 static struct thread_info *thread_list = NULL;
 static int highest_thread_num;
 
-static void
-thread_command PARAMS ((char * tidstr, int from_tty));
-static void
-prune_threads PARAMS ((void));
-
-static void
-switch_to_thread PARAMS ((int pid));
-
-static struct thread_info *
-find_thread_id PARAMS ((int num));
-
-static void
-info_threads_command PARAMS ((char *, int));
-
-static void
-restore_current_thread PARAMS ((int));
-
-static void
-thread_apply_all_command PARAMS ((char *, int));
-
-static void
-thread_apply_command PARAMS ((char *, int));
-
-static void info_threads_command PARAMS ((char *, int));
-
-static void restore_current_thread PARAMS ((int));
+static struct thread_info * find_thread_id PARAMS ((int num));
 
+static void thread_command PARAMS ((char * tidstr, int from_tty));
 static void thread_apply_all_command PARAMS ((char *, int));
-
+static int  thread_alive PARAMS ((struct thread_info *));
+static void info_threads_command PARAMS ((char *, int));
 static void thread_apply_command PARAMS ((char *, int));
-
-static int thread_alive PARAMS ((struct thread_info *));
+static void restore_current_thread PARAMS ((int));
+static void switch_to_thread PARAMS ((int pid));
+static void prune_threads PARAMS ((void));
 
 void
 init_thread_list ()
@@ -322,9 +234,9 @@ void load_infrun_state (pid, prev_pc, prev_func_start, prev_func_name,
                        through_sigtramp_breakpoint, step_range_start,
                        step_range_end, step_frame_address,
                        handling_longjmp, another_trap,
-                        stepping_through_solib_after_catch,
-                        stepping_through_solib_catchpoints,
-                        stepping_through_sigtramp)
+                       stepping_through_solib_after_catch,
+                       stepping_through_solib_catchpoints,
+                       stepping_through_sigtramp)
      int pid;
      CORE_ADDR *prev_pc;
      CORE_ADDR *prev_func_start;
@@ -372,9 +284,9 @@ void save_infrun_state (pid, prev_pc, prev_func_start, prev_func_name,
                        through_sigtramp_breakpoint, step_range_start,
                        step_range_end, step_frame_address,
                        handling_longjmp, another_trap,
-                        stepping_through_solib_after_catch,
-                        stepping_through_solib_catchpoints,
-                        stepping_through_sigtramp)
+                       stepping_through_solib_after_catch,
+                       stepping_through_solib_catchpoints,
+                       stepping_through_sigtramp)
      int pid;
      CORE_ADDR prev_pc;
      CORE_ADDR prev_func_start;
@@ -465,8 +377,8 @@ info_threads_command (arg, from_tty)
      int from_tty;
 {
   struct thread_info *tp;
-  int current_pid = inferior_pid;
-  struct frame_info *cur_frame;
+  int                current_pid;
+  struct frame_info  *cur_frame;
   int                saved_frame_level = selected_frame_level;
   int                counter;
 
@@ -475,10 +387,8 @@ info_threads_command (arg, from_tty)
   if (!target_has_stack) error ("No stack.");
 
   prune_threads ();
-#if defined(FIND_NEW_THREADS)
-  FIND_NEW_THREADS ();
-#endif
-
+  target_find_new_threads ();
+  current_pid = inferior_pid;
   for (tp = thread_list; tp; tp = tp->next)
     {
       if (tp->pid == current_pid)
@@ -508,14 +418,16 @@ info_threads_command (arg, from_tty)
    */
   counter   = saved_frame_level;
   cur_frame = find_relative_frame(selected_frame, &counter);
-  if (counter != 0) {
+  if (counter != 0)
+    {
       /* Ooops, can't restore, tell user where we are. */
       warning ("Couldn't restore frame in current thread, at frame 0");
       print_stack_frame (selected_frame, -1, 0);
-  }
-  else {
+    }
+  else
+    {
       select_frame(cur_frame, saved_frame_level);
-  }
+    }
 
   /* re-show current frame. */
   show_stack_frame(cur_frame);
@@ -541,10 +453,11 @@ static void
 restore_current_thread (pid)
      int pid;
 {
-  if (pid != inferior_pid) {
-    switch_to_thread (pid);
-    print_stack_frame( get_current_frame(), 0, -1);
-  }
+  if (pid != inferior_pid) 
+    {
+      switch_to_thread (pid);
+      print_stack_frame( get_current_frame(), 0, -1);
+    }
 }
 
 /* Apply a GDB command to a list of threads.  List syntax is a whitespace
@@ -568,16 +481,16 @@ thread_apply_all_command (cmd, from_tty)
     error ("Please specify a command following the thread ID list");
 
   old_chain = make_cleanup ((make_cleanup_func) restore_current_thread, 
-                            (void *) inferior_pid);
+                           (void *) inferior_pid);
 
   for (tp = thread_list; tp; tp = tp->next)
     if (thread_alive (tp))
       {
        switch_to_thread (tp->pid);
 #ifdef HPUXHPPA
-     printf_filtered ("\nThread %d (%s):\n",
-                       tp->num,
-                      target_tid_to_str (inferior_pid));
+       printf_filtered ("\nThread %d (%s):\n",
+                        tp->num,
+                        target_tid_to_str (inferior_pid));
 #else
        printf_filtered ("\nThread %d (%s):\n", tp->num,
                         target_pid_to_str (inferior_pid));
@@ -604,7 +517,7 @@ thread_apply_command (tidlist, from_tty)
     error ("Please specify a command following the thread ID list");
 
   old_chain = make_cleanup ((make_cleanup_func) restore_current_thread, 
-                            (void *) inferior_pid);
+                           (void *) inferior_pid);
 
   while (tidlist < cmd)
     {
@@ -645,8 +558,8 @@ thread_apply_command (tidlist, from_tty)
            {
              switch_to_thread (tp->pid);
 #ifdef HPUXHPPA
-         printf_filtered ("\nThread %d (%s):\n", tp->num,
-                          target_tid_to_str (inferior_pid));
+             printf_filtered ("\nThread %d (%s):\n", tp->num,
+                              target_tid_to_str (inferior_pid));
 #else
              printf_filtered ("\nThread %d (%s):\n", tp->num,
                               target_pid_to_str (inferior_pid));
@@ -718,7 +631,6 @@ void
 _initialize_thread ()
 {
   static struct cmd_list_element *thread_apply_list = NULL;
-  extern struct cmd_list_element *cmdlist;
 
   add_info ("threads", info_threads_command,
            "IDs of currently known threads.");
This page took 0.027543 seconds and 4 git commands to generate.