aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-11-05 20:23:07 +0000
committerPedro Alves <palves@redhat.com>2008-11-05 20:23:07 +0000
commite0ba674611b77dce4d02d6b08e90b10255ec3e2d (patch)
tree2e6dd7afb17800c925cd5c543347e28b03416cf0 /gdb/utils.c
parent6dc6b6558bf7ede38de5f7b9356d8d98e5960c33 (diff)
downloadfsf-binutils-gdb-e0ba674611b77dce4d02d6b08e90b10255ec3e2d.zip
fsf-binutils-gdb-e0ba674611b77dce4d02d6b08e90b10255ec3e2d.tar.gz
fsf-binutils-gdb-e0ba674611b77dce4d02d6b08e90b10255ec3e2d.tar.bz2
* defs.h (add_inferior_continuation)
(do_all_inferior_continuations) (discard_all_inferior_continuations): Declare. * utils.c (add_inferior_continuation) (do_all_inferior_continuations) (discard_all_inferior_continuations): New. * inferior.h (struct inferior) <continuations>: New field. * inferior.c (free_inferior): Discard all the inferior continuations. * inf-loop.c (inferior_event_handler): Do all current inferior continuations. * infcmd.c (attach_command): Register an inferior continuation instead of a thread continuation. * infrun.c (handle_inferior_event): If stop_soon is STOP_QUIETLY_NO_SIGSTOP, also expect a TARGET_SIGNAL_0.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 26d7933..fed2e7e 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -505,6 +505,59 @@ add_continuation (struct thread_info *thread,
thread->continuations = (struct continuation *) as_cleanup;
}
+/* Add a continuation to the continuation list of INFERIOR. The new
+ continuation will be added at the front. */
+
+void
+add_inferior_continuation (void (*continuation_hook) (void *), void *args,
+ void (*continuation_free_args) (void *))
+{
+ struct inferior *inf = current_inferior ();
+ struct cleanup *as_cleanup = &inf->continuations->base;
+ make_cleanup_ftype *continuation_hook_fn = continuation_hook;
+
+ make_my_cleanup2 (&as_cleanup,
+ continuation_hook_fn,
+ args,
+ continuation_free_args);
+
+ inf->continuations = (struct continuation *) as_cleanup;
+}
+
+/* Do all continuations of the current inferior. */
+
+void
+do_all_inferior_continuations (void)
+{
+ struct cleanup *old_chain;
+ struct cleanup *as_cleanup;
+ struct inferior *inf = current_inferior ();
+
+ if (inf->continuations == NULL)
+ return;
+
+ /* Copy the list header into another pointer, and set the global
+ list header to null, so that the global list can change as a side
+ effect of invoking the continuations and the processing of the
+ preexisting continuations will not be affected. */
+
+ as_cleanup = &inf->continuations->base;
+ inf->continuations = NULL;
+
+ /* Work now on the list we have set aside. */
+ do_my_cleanups (&as_cleanup, NULL);
+}
+
+/* Get rid of all the inferior-wide continuations of INF. */
+
+void
+discard_all_inferior_continuations (struct inferior *inf)
+{
+ struct cleanup *continuation_ptr = &inf->continuations->base;
+ discard_my_cleanups (&continuation_ptr, NULL);
+ inf->continuations = NULL;
+}
+
static void
restore_thread_cleanup (void *arg)
{