aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-04-24 11:13:44 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-04-24 11:13:44 +0000
commitf107f56344531e3fa4cc74cac1fe7dd7b056edab (patch)
treeeed53c115858c881d21a5dc2e16d415b47764870 /gdb/breakpoint.c
parent74960c600257a48df8589c16b527ab6f56d1a664 (diff)
downloadgdb-f107f56344531e3fa4cc74cac1fe7dd7b056edab.zip
gdb-f107f56344531e3fa4cc74cac1fe7dd7b056edab.tar.gz
gdb-f107f56344531e3fa4cc74cac1fe7dd7b056edab.tar.bz2
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.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c84
1 files changed, 38 insertions, 46 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 84802ef..2b6e16f 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -64,7 +64,8 @@
/* Prototypes for local functions. */
-static void until_break_command_continuation (struct continuation_arg *arg);
+static void until_break_command_continuation (struct continuation_arg *arg,
+ int error);
static void catch_command_1 (char *, int, int);
@@ -6130,12 +6131,11 @@ awatch_command (char *arg, int from_tty)
care of cleaning up the temporary breakpoints set up by the until
command. */
static void
-until_break_command_continuation (struct continuation_arg *arg)
+until_break_command_continuation (struct continuation_arg *arg, int error)
{
- struct cleanup *cleanups;
-
- cleanups = (struct cleanup *) arg->data.pointer;
- do_exec_cleanups (cleanups);
+ delete_breakpoint ((struct breakpoint *)(arg->data.pointer));
+ if (arg->next)
+ delete_breakpoint ((struct breakpoint *)(arg->next->data.pointer));
}
void
@@ -6146,8 +6146,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
struct frame_info *frame = get_selected_frame (NULL);
struct frame_info *prev_frame = get_prev_frame (frame);
struct breakpoint *breakpoint;
+ struct breakpoint *breakpoint2 = NULL;
struct cleanup *old_chain;
struct continuation_arg *arg1;
+ struct continuation_arg *arg2;
clear_proceed_status ();
@@ -6183,31 +6185,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame),
bp_until);
- if (!target_can_async_p ())
- old_chain = make_cleanup_delete_breakpoint (breakpoint);
- else
- old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
-
- /* If we are running asynchronously, and the target supports async
- execution, we are not waiting for the target to stop, in the call
- tp proceed, below. This means that we cannot delete the
- brekpoints until the target has actually stopped. The only place
- where we get a chance to do that is in fetch_inferior_event, so
- we must set things up for that. */
-
- if (target_can_async_p ())
- {
- /* In this case the arg for the continuation is just the point
- in the exec_cleanups chain from where to start doing
- cleanups, because all the continuation does is the cleanups in
- the exec_cleanup_chain. */
- arg1 =
- (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
- arg1->next = NULL;
- arg1->data.pointer = old_chain;
-
- add_continuation (until_break_command_continuation, arg1);
- }
+ old_chain = make_cleanup_delete_breakpoint (breakpoint);
/* Keep within the current frame, or in frames called by the current
one. */
@@ -6215,18 +6193,38 @@ until_break_command (char *arg, int from_tty, int anywhere)
{
sal = find_pc_line (get_frame_pc (prev_frame), 0);
sal.pc = get_frame_pc (prev_frame);
- breakpoint = set_momentary_breakpoint (sal, get_frame_id (prev_frame),
- bp_until);
- if (!target_can_async_p ())
- make_cleanup_delete_breakpoint (breakpoint);
- else
- make_exec_cleanup_delete_breakpoint (breakpoint);
+ breakpoint2 = set_momentary_breakpoint (sal, get_frame_id (prev_frame),
+ bp_until);
+ make_cleanup_delete_breakpoint (breakpoint2);
}
proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
- /* Do the cleanups now, anly if we are not running asynchronously,
- of if we are, but the target is still synchronous. */
- if (!target_can_async_p ())
+
+ /* If we are running asynchronously, and proceed call above has actually
+ managed to start the target, arrange for breakpoints to be
+ deleted when the target stops. Otherwise, we're already stopped and
+ delete breakpoints via cleanup chain. */
+
+ if (target_can_async_p () && target_executing)
+ {
+ arg1 =
+ (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
+ arg1->next = NULL;
+ arg1->data.pointer = breakpoint;
+
+ if (breakpoint2)
+ {
+ arg2 = (struct continuation_arg *)
+ xmalloc ( sizeof (struct continuation_arg));
+ arg2->next = NULL;
+ arg2->data.pointer = breakpoint2;
+ arg1->next = arg2;
+ }
+
+ discard_cleanups (old_chain);
+ add_continuation (until_break_command_continuation, arg1);
+ }
+ else
do_cleanups (old_chain);
}
@@ -7188,12 +7186,6 @@ make_cleanup_delete_breakpoint (struct breakpoint *b)
return make_cleanup (do_delete_breakpoint_cleanup, b);
}
-struct cleanup *
-make_exec_cleanup_delete_breakpoint (struct breakpoint *b)
-{
- return make_exec_cleanup (do_delete_breakpoint_cleanup, b);
-}
-
void
delete_command (char *arg, int from_tty)
{