From f107f56344531e3fa4cc74cac1fe7dd7b056edab Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Thu, 24 Apr 2008 11:13:44 +0000 Subject: exec_cleanup murder. * breakpoint.c (until_break_command_continuation): Add the 'error' parameter. Directly delete the breakoint as opposed to running cleanups. (until_break_command): Install continuation only after starting the target. Don't use exec cleanups, use ordinary cleanups. Discard cleanups is successfully started the target in async mode. (make_cleanup_delete_breakpoint): Remove. * breakpoint.h (make_cleanup_delete_breakpoint): Remove declaration. * defs.h (do_exec_cleanups, make_exec_cleanup): Remove declarations. (struct continations): Add the 'error' parameter to the continuation_hook field. (add_continuation, do_all_continuations) (add_intermediate_continuation) (do_all_intermediate_continuations): Add the 'error' parameter. * exceptions.c (throw_exception): Don't call do_exec_cleanups. * inf-loop.c (inferior_event_handler): Instead of calling discard_all_continuations, use do_all_continuations with 1 as 'error' parameter. Pass 0 as 'error' parameter in existing uses of discard_all_continuations. * infcmd.c (step_1): Do not use exec cleanup. For async case, discard cleanups. (step_once): Install continuation only after resuming the target. (step_1_continuation): Disable longjmp breakpoint on error. (finish_command_continuation): Add the error parameter. Delete the finish breakpoint directly, do not use cleanups. (finish_command): Do not use exec_cleanups. Always setup continuation. For sync case, immediately run them. (attach_command_continuation): Add the error parameter. * infrun.c (fetch_inferior_event): Do not use exec cleanups to remove step_resume_breakpoint -- adjust delete it directly. * interps.c (interp_set): Adjust call to do_all_continations. * mi/mi-interp.c (mi_interpreter_exec_continuation): Do not do exec cleanups. * mi/mi-main.c (mi_cmd_target_select): Do not do exec cleanups. (mi_cmd_execute): Do not use exec_cleanup. (mi_execute_async_cli_command): Simplify the string concatenation logic. Do no use exec cleanup. (mi_exec_async_cli_cmd_continuation): New parameter error. Free last_async_command. * top.c (command_line_handler_continuation): New parameter error. * utils.c (exec_cleanup_chain, make_exec_cleanup) (do_exec_cleanups): Remove. (add_continuation, do_all_continations) (add_intermediate_continuation) (do_all_intermediate_continuations): New parameter error. --- gdb/utils.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index 594fc73..d9953a0 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -104,7 +104,6 @@ static int debug_timestamp = 0; static struct cleanup *cleanup_chain; /* cleaned up after a failed command */ static struct cleanup *final_cleanup_chain; /* cleaned up when gdb exits */ -static struct cleanup *exec_cleanup_chain; /* cleaned up on each execution command */ /* Pointer to what is left to do for an execution command after the target stops. Used only in asynchronous mode, by targets that @@ -214,12 +213,6 @@ make_final_cleanup (make_cleanup_ftype *function, void *arg) return make_my_cleanup (&final_cleanup_chain, function, arg); } -struct cleanup * -make_exec_cleanup (make_cleanup_ftype *function, void *arg) -{ - return make_my_cleanup (&exec_cleanup_chain, function, arg); -} - static void do_freeargv (void *arg) { @@ -316,12 +309,6 @@ do_final_cleanups (struct cleanup *old_chain) do_my_cleanups (&final_cleanup_chain, old_chain); } -void -do_exec_cleanups (struct cleanup *old_chain) -{ - do_my_cleanups (&exec_cleanup_chain, old_chain); -} - static void do_my_cleanups (struct cleanup **pmy_chain, struct cleanup *old_chain) @@ -440,7 +427,7 @@ null_cleanup (void *arg) /* Add a continuation to the continuation list, the global list cmd_continuation. The new continuation will be added at the front.*/ void -add_continuation (void (*continuation_hook) (struct continuation_arg *), +add_continuation (void (*continuation_hook) (struct continuation_arg *, int), struct continuation_arg *arg_list) { struct continuation *continuation_ptr; @@ -462,7 +449,7 @@ add_continuation (void (*continuation_hook) (struct continuation_arg *), and do the continuations from there on, instead of using the global beginning of list as our iteration pointer. */ void -do_all_continuations (void) +do_all_continuations (int error) { struct continuation *continuation_ptr; struct continuation *saved_continuation; @@ -477,7 +464,7 @@ do_all_continuations (void) /* Work now on the list we have set aside. */ while (continuation_ptr) { - (continuation_ptr->continuation_hook) (continuation_ptr->arg_list); + (continuation_ptr->continuation_hook) (continuation_ptr->arg_list, error); saved_continuation = continuation_ptr; continuation_ptr = continuation_ptr->next; xfree (saved_continuation); @@ -504,7 +491,7 @@ discard_all_continuations (void) the front. */ void add_intermediate_continuation (void (*continuation_hook) - (struct continuation_arg *), + (struct continuation_arg *, int), struct continuation_arg *arg_list) { struct continuation *continuation_ptr; @@ -526,7 +513,7 @@ add_intermediate_continuation (void (*continuation_hook) and do the continuations from there on, instead of using the global beginning of list as our iteration pointer.*/ void -do_all_intermediate_continuations (void) +do_all_intermediate_continuations (int error) { struct continuation *continuation_ptr; struct continuation *saved_continuation; @@ -541,7 +528,7 @@ do_all_intermediate_continuations (void) /* Work now on the list we have set aside. */ while (continuation_ptr) { - (continuation_ptr->continuation_hook) (continuation_ptr->arg_list); + (continuation_ptr->continuation_hook) (continuation_ptr->arg_list, error); saved_continuation = continuation_ptr; continuation_ptr = continuation_ptr->next; xfree (saved_continuation); -- cgit v1.1