+/* Load infrun state for the thread PID. */
+
+void
+load_infrun_state (pid, prev_pc, prev_func_start, prev_func_name,
+ trap_expected, step_resume_breakpoint,
+ 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)
+ int pid;
+ CORE_ADDR *prev_pc;
+ CORE_ADDR *prev_func_start;
+ char **prev_func_name;
+ int *trap_expected;
+ struct breakpoint **step_resume_breakpoint;
+ struct breakpoint **through_sigtramp_breakpoint;
+ CORE_ADDR *step_range_start;
+ CORE_ADDR *step_range_end;
+ CORE_ADDR *step_frame_address;
+ int *handling_longjmp;
+ int *another_trap;
+ int *stepping_through_solib_after_catch;
+ bpstat *stepping_through_solib_catchpoints;
+ int *stepping_through_sigtramp;
+{
+ struct thread_info *tp;
+
+ /* If we can't find the thread, then we're debugging a single threaded
+ process. No need to do anything in that case. */
+ tp = find_thread_id (pid_to_thread_id (pid));
+ if (tp == NULL)
+ return;
+
+ *prev_pc = tp->prev_pc;
+ *prev_func_start = tp->prev_func_start;
+ *prev_func_name = tp->prev_func_name;
+ *step_resume_breakpoint = tp->step_resume_breakpoint;
+ *step_range_start = tp->step_range_start;
+ *step_range_end = tp->step_range_end;
+ *step_frame_address = tp->step_frame_address;
+ *through_sigtramp_breakpoint = tp->through_sigtramp_breakpoint;
+ *handling_longjmp = tp->handling_longjmp;
+ *trap_expected = tp->trap_expected;
+ *another_trap = tp->another_trap;
+ *stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch;
+ *stepping_through_solib_catchpoints = tp->stepping_through_solib_catchpoints;
+ *stepping_through_sigtramp = tp->stepping_through_sigtramp;
+}
+
+/* Save infrun state for the thread PID. */
+
+void
+save_infrun_state (pid, prev_pc, prev_func_start, prev_func_name,
+ trap_expected, step_resume_breakpoint,
+ 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)
+ int pid;
+ CORE_ADDR prev_pc;
+ CORE_ADDR prev_func_start;
+ char *prev_func_name;
+ int trap_expected;
+ struct breakpoint *step_resume_breakpoint;
+ struct breakpoint *through_sigtramp_breakpoint;
+ CORE_ADDR step_range_start;
+ CORE_ADDR step_range_end;
+ CORE_ADDR step_frame_address;
+ int handling_longjmp;
+ int another_trap;
+ int stepping_through_solib_after_catch;
+ bpstat stepping_through_solib_catchpoints;
+ int stepping_through_sigtramp;
+{
+ struct thread_info *tp;
+
+ /* If we can't find the thread, then we're debugging a single-threaded
+ process. Nothing to do in that case. */
+ tp = find_thread_id (pid_to_thread_id (pid));
+ if (tp == NULL)
+ return;
+
+ tp->prev_pc = prev_pc;
+ tp->prev_func_start = prev_func_start;
+ tp->prev_func_name = prev_func_name;
+ tp->step_resume_breakpoint = step_resume_breakpoint;
+ tp->step_range_start = step_range_start;
+ tp->step_range_end = step_range_end;
+ tp->step_frame_address = step_frame_address;
+ tp->through_sigtramp_breakpoint = through_sigtramp_breakpoint;
+ tp->handling_longjmp = handling_longjmp;
+ tp->trap_expected = trap_expected;
+ tp->another_trap = another_trap;
+ tp->stepping_through_solib_after_catch = stepping_through_solib_after_catch;
+ tp->stepping_through_solib_catchpoints = stepping_through_solib_catchpoints;
+ tp->stepping_through_sigtramp = stepping_through_sigtramp;
+}
+
+/* Return true if TP is an active thread. */
+static int
+thread_alive (tp)
+ struct thread_info *tp;
+{
+ if (tp->pid == -1)
+ return 0;
+ if (!target_thread_alive (tp->pid))
+ {
+ tp->pid = -1; /* Mark it as dead */
+ return 0;
+ }
+ return 1;
+}
+
+static void
+prune_threads ()
+{
+ struct thread_info *tp, *next;
+
+ for (tp = thread_list; tp; tp = next)
+ {
+ next = tp->next;
+ if (!thread_alive (tp))
+ delete_thread (tp->pid);
+ }
+}
+
+/* Print information about currently known threads
+
+ * Note: this has the drawback that it _really_ switches
+ * threads, which frees the frame cache. A no-side
+ * effects info-threads command would be nicer.
+ */