summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2008-07-13 11:28:31 +0000
committerPedro Alves <pedro@codesourcery.com>2008-07-13 11:28:31 +0000
commit9d777ada47af8c52cd08c4e6be533ec94ea7bd2d (patch)
tree7bc58012feeb4eefd0f76155572ab51fcf70fb7c
parentf4a8b72bc68a7d31800dccce8edeac8813d0f38b (diff)
downloadgdb-9d777ada47af8c52cd08c4e6be533ec94ea7bd2d.tar.gz
* utils.c (struct continuation): Define as inheriting struct
cleanup. (add_continuation, do_all_continuations) (discard_all_continuations, add_intermediate_continuation) (do_all_intermediate_continuations) (discard_all_intermediate_continuations): Adjust.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/utils.c37
2 files changed, 34 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8f16d1c9ec2..a592d20ed1c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2008-07-13 Pedro Alves <pedro@codesourcery.com>
+
+ * utils.c (struct continuation): Define as inheriting struct
+ cleanup.
+ (add_continuation, do_all_continuations)
+ (discard_all_continuations, add_intermediate_continuation)
+ (do_all_intermediate_continuations)
+ (discard_all_intermediate_continuations): Adjust.
+
2008-07-13 Vladimir Prus <vladimir@codesourcery.com>
Skip varobj in running threads.
diff --git a/gdb/utils.c b/gdb/utils.c
index 2b34d3e0200..c787dd044d3 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -470,19 +470,29 @@ null_cleanup (void *arg)
{
}
+/* Continuations are implemented as cleanups internally. Inherit from
+ cleanups. */
+struct continuation
+{
+ struct cleanup base;
+};
+
/* Add a continuation to the continuation list, the global list
- cmd_continuation. The new continuation will be added at the front.*/
+ cmd_continuation. The new continuation will be added at the
+ front. */
void
add_continuation (void (*continuation_hook) (void *), void *args,
void (*continuation_free_args) (void *))
{
- struct cleanup **as_cleanup_p = (struct cleanup **) &cmd_continuation;
+ struct cleanup *as_cleanup = &cmd_continuation->base;
make_cleanup_ftype *continuation_hook_fn = continuation_hook;
- make_my_cleanup2 (as_cleanup_p,
+ make_my_cleanup2 (&as_cleanup,
continuation_hook_fn,
args,
continuation_free_args);
+
+ cmd_continuation = (struct continuation *) as_cleanup;
}
/* Walk down the cmd_continuation list, and execute all the
@@ -503,7 +513,7 @@ do_all_continuations (void)
effect of invoking the continuations and the processing of the
preexisting continuations will not be affected. */
- continuation_ptr = (struct cleanup *) cmd_continuation;
+ continuation_ptr = &cmd_continuation->base;
cmd_continuation = NULL;
/* Work now on the list we have set aside. */
@@ -515,8 +525,9 @@ do_all_continuations (void)
void
discard_all_continuations (void)
{
- struct cleanup **continuation_ptr = (struct cleanup **) &cmd_continuation;
- discard_my_cleanups (continuation_ptr, NULL);
+ struct cleanup *continuation_ptr = &cmd_continuation->base;
+ discard_my_cleanups (&continuation_ptr, NULL);
+ cmd_continuation = NULL;
}
/* Add a continuation to the continuation list, the global list
@@ -527,13 +538,15 @@ add_intermediate_continuation (void (*continuation_hook)
(void *), void *args,
void (*continuation_free_args) (void *))
{
- struct cleanup **as_cleanup_p = (struct cleanup **) &intermediate_continuation;
+ struct cleanup *as_cleanup = &intermediate_continuation->base;
make_cleanup_ftype *continuation_hook_fn = continuation_hook;
- make_my_cleanup2 (as_cleanup_p,
+ make_my_cleanup2 (&as_cleanup,
continuation_hook_fn,
args,
continuation_free_args);
+
+ intermediate_continuation = (struct continuation *) as_cleanup;
}
/* Walk down the cmd_continuation list, and execute all the
@@ -554,7 +567,7 @@ do_all_intermediate_continuations (void)
effect of invoking the continuations and the processing of the
preexisting continuations will not be affected. */
- continuation_ptr = (struct cleanup *) intermediate_continuation;
+ continuation_ptr = &intermediate_continuation->base;
intermediate_continuation = NULL;
/* Work now on the list we have set aside. */
@@ -566,9 +579,9 @@ do_all_intermediate_continuations (void)
void
discard_all_intermediate_continuations (void)
{
- struct cleanup **continuation_ptr
- = (struct cleanup **) &intermediate_continuation;
- discard_my_cleanups (continuation_ptr, NULL);
+ struct cleanup *continuation_ptr = &intermediate_continuation->base;
+ discard_my_cleanups (&continuation_ptr, NULL);
+ continuation_ptr = NULL;
}