2008-07-12 Pedro Alves <pedro@codesourcery.com>

Rewrite continuations internals on top of cleanups and plug
	continuation arguments leaks.

	* defs.h (struct continuation): Make it opaque.
	(add_continuation, add_intermediate_continuation): Drop the int
	argument of the continuation hook argument.  Add
	continuation_free_args argument.
	(do_all_continuations, do_all_intermediate_continuations): Drop
	the error_p argument.

	* utils.c (add_continuation): Drop the int argument of the
	continuation hook argument.  Add continuation_free_args argument.
	Reimplement on top of cleanups.
	(do_all_continuations): Drop error argument.  Reimplement on top
	of cleanups.
	(discard_all_continuations): Reimplement on top of cleanups.
	(add_intermediate_continuation): Drop the int argument of the
	continuation hook argument.  Add continuation_free_args argument.
	Reimplement on top of cleanups.
	(do_all_intermediate_continuations): Drop error argument.
	Reimplement on top of cleanups.
	(discard_all_intermediate_continuations): Reimplement on top of
	cleanups.

	* breakpoint.c (until_break_command_continuation): Drop error
	argument.  Add xfree as continuation argument deleter.

	* inf-loop.c (inferior_event_handler): On error, discard all
	continuations.  Adjust to new do_all_intermediate_continuations
	and do_all_continuations interfaces.

	* infcmd.c (step_1_continuation): Drop error_p argument.  Adjust.
	Pass xfree as continuation argument deleter.
	(finish_command_continuation): Drop error_p argument.  Adjust.
	(finish_command_continuation_free_arg): New.
	(finish_command): Pass finish_command_continuation_free_arg as
	continuation argument deleter.  Adjust to new do_all_continuations
	interfaces.
	(attach_command_continuation): Drop error_p argument.
	(attach_command_continuation_free_args): New.
	(attach_command): Pass attach_command_continuation_free_args as
	continuation argument deleter.

	* interps.c (interp_set): Adjust to new do_all_continuations
	interfaces.

	* event-top.c (stdin_event_handler): In error, also discard the
	intermediate continuations.
This commit is contained in:
Pedro Alves 2008-07-12 19:25:42 +00:00
parent bfec99b27c
commit 604ead4a92
8 changed files with 150 additions and 108 deletions

View file

@ -52,7 +52,8 @@ inferior_event_handler (enum inferior_event_type event_type,
printf_unfiltered (_("error detected from target.\n"));
target_async (NULL, 0);
pop_target ();
do_all_continuations (1);
discard_all_intermediate_continuations ();
discard_all_continuations ();
async_enable_stdin ();
break;
@ -66,7 +67,8 @@ inferior_event_handler (enum inferior_event_type event_type,
{
target_async (NULL, 0);
pop_target ();
do_all_continuations (1);
discard_all_intermediate_continuations ();
discard_all_continuations ();
async_enable_stdin ();
display_gdb_prompt (0);
}
@ -96,13 +98,13 @@ inferior_event_handler (enum inferior_event_type event_type,
touch the inferior memory, e.g. to remove breakpoints, so run
them before running breakpoint commands, which may resume the
target. */
do_all_intermediate_continuations (0);
do_all_intermediate_continuations ();
/* Always finish the previous command before running any
breakpoint commands. Any stop cancels the previous command.
E.g. a "finish" or "step-n" command interrupted by an
unrelated breakpoint is canceled. */
do_all_continuations (0);
do_all_continuations ();
if (current_language != expected_language
&& language_mode == language_mode_auto)
@ -123,7 +125,7 @@ inferior_event_handler (enum inferior_event_type event_type,
case INF_EXEC_CONTINUE:
/* Is there anything left to do for the command issued to
complete? */
do_all_intermediate_continuations (0);
do_all_intermediate_continuations ();
break;
case INF_QUIT_REQ: