static void info_threads_command (char *, int);
static void thread_apply_command (char *, int);
static void restore_current_thread (ptid_t);
-static void prune_threads (void);
/* Data to cleanup thread array. */
return tp;
}
-void
-delete_step_resume_breakpoint (struct thread_info *tp)
+/* Delete the breakpoint pointed at by BP_P, if there's one. */
+
+static void
+delete_thread_breakpoint (struct breakpoint **bp_p)
{
- if (tp && tp->control.step_resume_breakpoint)
+ if (*bp_p != NULL)
{
- delete_breakpoint (tp->control.step_resume_breakpoint);
- tp->control.step_resume_breakpoint = NULL;
+ delete_breakpoint (*bp_p);
+ *bp_p = NULL;
}
}
+void
+delete_step_resume_breakpoint (struct thread_info *tp)
+{
+ if (tp != NULL)
+ delete_thread_breakpoint (&tp->control.step_resume_breakpoint);
+}
+
void
delete_exception_resume_breakpoint (struct thread_info *tp)
{
- if (tp && tp->control.exception_resume_breakpoint)
+ if (tp != NULL)
+ delete_thread_breakpoint (&tp->control.exception_resume_breakpoint);
+}
+
+/* See gdbthread.h. */
+
+void
+delete_single_step_breakpoints (struct thread_info *tp)
+{
+ if (tp != NULL)
+ delete_thread_breakpoint (&tp->control.single_step_breakpoints);
+}
+
+/* Delete the breakpoint pointed at by BP_P at the next stop, if
+ there's one. */
+
+static void
+delete_at_next_stop (struct breakpoint **bp)
+{
+ if (*bp != NULL)
{
- delete_breakpoint (tp->control.exception_resume_breakpoint);
- tp->control.exception_resume_breakpoint = NULL;
+ (*bp)->disposition = disp_del_at_next_stop;
+ *bp = NULL;
}
}
+/* See gdbthread.h. */
+
+int
+thread_has_single_step_breakpoints_set (struct thread_info *tp)
+{
+ return tp->control.single_step_breakpoints != NULL;
+}
+
+/* See gdbthread.h. */
+
+int
+thread_has_single_step_breakpoint_here (struct thread_info *tp,
+ struct address_space *aspace,
+ CORE_ADDR addr)
+{
+ struct breakpoint *ss_bps = tp->control.single_step_breakpoints;
+
+ return (ss_bps != NULL
+ && breakpoint_has_location_inserted_here (ss_bps, aspace, addr));
+}
+
static void
clear_thread_inferior_resources (struct thread_info *tp)
{
but not any user-specified thread-specific breakpoints. We can not
delete the breakpoint straight-off, because the inferior might not
be stopped at the moment. */
- if (tp->control.step_resume_breakpoint)
- {
- tp->control.step_resume_breakpoint->disposition = disp_del_at_next_stop;
- tp->control.step_resume_breakpoint = NULL;
- }
-
- if (tp->control.exception_resume_breakpoint)
- {
- tp->control.exception_resume_breakpoint->disposition
- = disp_del_at_next_stop;
- tp->control.exception_resume_breakpoint = NULL;
- }
+ delete_at_next_stop (&tp->control.step_resume_breakpoint);
+ delete_at_next_stop (&tp->control.exception_resume_breakpoint);
+ delete_at_next_stop (&tp->control.single_step_breakpoints);
delete_longjmp_breakpoint_at_next_stop (tp->num);
return 1;
}
-static void
+/* See gdbthreads.h. */
+
+void
prune_threads (void)
{
struct thread_info *tp, *next;
}
}
+/* Disable storing stack temporaries for the thread whose id is
+ stored in DATA. */
+
+static void
+disable_thread_stack_temporaries (void *data)
+{
+ ptid_t *pd = data;
+ struct thread_info *tp = find_thread_ptid (*pd);
+
+ if (tp != NULL)
+ {
+ tp->stack_temporaries_enabled = 0;
+ VEC_free (value_ptr, tp->stack_temporaries);
+ }
+
+ xfree (pd);
+}
+
+/* Enable storing stack temporaries for thread with id PTID and return a
+ cleanup which can disable and clear the stack temporaries. */
+
+struct cleanup *
+enable_thread_stack_temporaries (ptid_t ptid)
+{
+ struct thread_info *tp = find_thread_ptid (ptid);
+ ptid_t *data;
+ struct cleanup *c;
+
+ gdb_assert (tp != NULL);
+
+ tp->stack_temporaries_enabled = 1;
+ tp->stack_temporaries = NULL;
+ data = (ptid_t *) xmalloc (sizeof (ptid_t));
+ *data = ptid;
+ c = make_cleanup (disable_thread_stack_temporaries, data);
+
+ return c;
+}
+
+/* Return non-zero value if stack temporaies are enabled for the thread
+ with id PTID. */
+
+int
+thread_stack_temporaries_enabled_p (ptid_t ptid)
+{
+ struct thread_info *tp = find_thread_ptid (ptid);
+
+ if (tp == NULL)
+ return 0;
+ else
+ return tp->stack_temporaries_enabled;
+}
+
+/* Push V on to the stack temporaries of the thread with id PTID. */
+
+void
+push_thread_stack_temporary (ptid_t ptid, struct value *v)
+{
+ struct thread_info *tp = find_thread_ptid (ptid);
+
+ gdb_assert (tp != NULL && tp->stack_temporaries_enabled);
+ VEC_safe_push (value_ptr, tp->stack_temporaries, v);
+}
+
+/* Return 1 if VAL is among the stack temporaries of the thread
+ with id PTID. Return 0 otherwise. */
+
+int
+value_in_thread_stack_temporaries (struct value *val, ptid_t ptid)
+{
+ struct thread_info *tp = find_thread_ptid (ptid);
+
+ gdb_assert (tp != NULL && tp->stack_temporaries_enabled);
+ if (!VEC_empty (value_ptr, tp->stack_temporaries))
+ {
+ struct value *v;
+ int i;
+
+ for (i = 0; VEC_iterate (value_ptr, tp->stack_temporaries, i, v); i++)
+ if (v == val)
+ return 1;
+ }
+
+ return 0;
+}
+
+/* Return the last of the stack temporaries for thread with id PTID.
+ Return NULL if there are no stack temporaries for the thread. */
+
+struct value *
+get_last_thread_stack_temporary (ptid_t ptid)
+{
+ struct value *lastval = NULL;
+ struct thread_info *tp = find_thread_ptid (ptid);
+
+ gdb_assert (tp != NULL);
+ if (!VEC_empty (value_ptr, tp->stack_temporaries))
+ lastval = VEC_last (value_ptr, tp->stack_temporaries);
+
+ return lastval;
+}
+
void
thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid)
{
void
update_thread_list (void)
{
- prune_threads ();
- target_find_new_threads ();
+ target_update_thread_list ();
update_threads_executing ();
}