From: Michael Snyder Date: Thu, 9 Oct 2008 17:45:01 +0000 (+0000) Subject: 2008-10-09 Michael Snyder X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=474a0450be6d2cd5b7e7d7f64f637b3ed7a87f2d;p=thirdparty%2Fbinutils-gdb.git 2008-10-09 Michael Snyder * infcmd.c (finish_forward): New function, abstracted from finish_command. (finish_command): Abstract out finish_forward for symmetry. * infrun.c (use_displaced_stepping): Add comment. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 035ffe8f6f2..7f1dae85c32 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2008-10-09 Michael Snyder + + * infcmd.c (finish_forward): New function, abstracted from + finish_command. + (finish_command): Abstract out finish_forward for symmetry. + * infrun.c (use_displaced_stepping): Add comment. + 2008-10-08 Hui Zhu * record.c (record_open): Reset after push_target. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 131f4af8263..e5f9a537b2b 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1370,9 +1370,10 @@ finish_command_continuation_free_arg (void *arg) /* finish_backward -- helper function for finish_command. */ static void -finish_backward (struct symbol *function, struct thread_info *tp) +finish_backward (struct symbol *function) { struct symtab_and_line sal; + struct thread_info *tp = inferior_thread (); struct breakpoint *breakpoint; struct cleanup *old_chain; CORE_ADDR func_addr; @@ -1385,8 +1386,6 @@ finish_backward (struct symbol *function, struct thread_info *tp) sal = find_pc_line (func_addr, 0); - /* TODO: Let's not worry about async until later. */ - /* We don't need a return value. */ tp->proceed_to_finish = 0; /* Special case: if we're sitting at the function entry point, @@ -1421,26 +1420,56 @@ finish_backward (struct symbol *function, struct thread_info *tp) /* If in fact we hit the step-resume breakpoint (and not some other breakpoint), then we're almost there -- we just need to back up by one more single-step. */ - /* (Kludgy way of letting wait_for_inferior know...) */ tp->step_range_start = tp->step_range_end = 1; proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1); } return; } +/* finish_forward -- helper function for finish_command. */ + +static void +finish_forward (struct symbol *function, struct frame_info *frame) +{ + struct symtab_and_line sal; + struct thread_info *tp = inferior_thread (); + struct breakpoint *breakpoint; + struct cleanup *old_chain; + struct finish_command_continuation_args *cargs; + + sal = find_pc_line (get_frame_pc (frame), 0); + sal.pc = get_frame_pc (frame); + + breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame), + bp_finish); + + old_chain = make_cleanup_delete_breakpoint (breakpoint); + + tp->proceed_to_finish = 1; /* We want stop_registers, please... */ + make_cleanup_restore_integer (&suppress_stop_observer); + suppress_stop_observer = 1; + proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); + + cargs = xmalloc (sizeof (*cargs)); + + cargs->breakpoint = breakpoint; + cargs->function = function; + add_continuation (tp, finish_command_continuation, cargs, + finish_command_continuation_free_arg); + + discard_cleanups (old_chain); + if (!target_can_async_p ()) + do_all_continuations (); +} + /* "finish": Set a temporary breakpoint at the place the selected frame will return to, then continue. */ static void finish_command (char *arg, int from_tty) { - struct symtab_and_line sal; struct frame_info *frame; struct symbol *function; - struct breakpoint *breakpoint; - struct cleanup *old_chain; - struct finish_command_continuation_args *cargs; - struct thread_info *tp; int async_exec = 0; @@ -1474,8 +1503,6 @@ finish_command (char *arg, int from_tty) if (frame == 0) error (_("\"finish\" not meaningful in the outermost frame.")); - tp = inferior_thread (); - clear_proceed_status (); /* Find the function we will return from. */ @@ -1495,35 +1522,9 @@ finish_command (char *arg, int from_tty) } if (execution_direction == EXEC_REVERSE) - { - /* Split off at this point. */ - finish_backward (function, tp); - return; - } - - sal = find_pc_line (get_frame_pc (frame), 0); - sal.pc = get_frame_pc (frame); - - breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame), - bp_finish); - - old_chain = make_cleanup_delete_breakpoint (breakpoint); - - tp->proceed_to_finish = 1; /* We want stop_registers, please... */ - make_cleanup_restore_integer (&suppress_stop_observer); - suppress_stop_observer = 1; - proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); - - cargs = xmalloc (sizeof (*cargs)); - - cargs->breakpoint = breakpoint; - cargs->function = function; - add_continuation (tp, finish_command_continuation, cargs, - finish_command_continuation_free_arg); - - discard_cleanups (old_chain); - if (!target_can_async_p ()) - do_all_continuations (); + finish_backward (function); + else + finish_forward (function, frame); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 1449b076ff2..4bac5ea5663 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -571,6 +571,7 @@ Debugger's willingness to use displaced stepping to step over " /* Return non-zero if displaced stepping is enabled, and can be used with GDBARCH. */ +/* Disable when using the process record/replay target. */ static int use_displaced_stepping (struct gdbarch *gdbarch) {