diff options
author | Michael Snyder <msnyder@specifix.com> | 2008-10-09 17:44:59 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@specifix.com> | 2008-10-09 17:44:59 +0000 |
commit | 7b0695c2b72e81a1d0493c1031136efbd4d6ea07 (patch) | |
tree | f359898efa655d28960ac3747e560207648b5bba | |
parent | 903e6bbbc7d0d642eed10f96a416515cb53d6015 (diff) | |
download | gdb-7b0695c2b72e81a1d0493c1031136efbd4d6ea07.tar.gz |
2008-10-09 Michael Snyder <msnyder@vmware.com>
* 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.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/infcmd.c | 81 | ||||
-rw-r--r-- | gdb/infrun.c | 1 |
3 files changed, 49 insertions, 40 deletions
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 <msnyder@vmware.com> + + * 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 <teawater@gmail.com> * 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) { |