aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1991-10-22 00:50:58 +0000
committerStu Grossman <grossman@cygnus>1991-10-22 00:50:58 +0000
commitb3b39c0c762d904a1c31538f8d88b6e1b0e5f5db (patch)
tree1179581b027daf1d22f35c299864e35ade96d583 /gdb
parent30ff2d72e0b53c239c43f8f3caa9cf2d8bbf4a93 (diff)
downloadgdb-b3b39c0c762d904a1c31538f8d88b6e1b0e5f5db.zip
gdb-b3b39c0c762d904a1c31538f8d88b6e1b0e5f5db.tar.gz
gdb-b3b39c0c762d904a1c31538f8d88b6e1b0e5f5db.tar.bz2
* infrun.c (wait_for_inferior): fix stepi/nexti that was broken
by my last edit to this routine.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/infrun.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index e81c1fd..5f85779 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -508,6 +508,13 @@ child_create_inferior (exec_file, allargs, env)
new_tty_prefork (inferior_io_terminal);
+ /* It is generally good practice to flush any possible pending stdio
+ output prior to doing a fork, to avoid the possibility of both the
+ parent and child flushing the same data after the fork. */
+
+ fflush (stdout);
+ fflush (stderr);
+
#if defined(USG) && !defined(HAVE_VFORK)
pid = fork ();
#else
@@ -762,6 +769,7 @@ wait_for_inferior ()
#ifdef TDESC
extern dc_handle_t tdesc_handle;
#endif
+ int current_line;
#if 0
/* This no longer works now that read_register is lazy;
@@ -773,6 +781,9 @@ wait_for_inferior ()
prev_sp = read_register (SP_REGNUM);
#endif /* 0 */
+ sal = find_pc_line(prev_pc, 0);
+ current_line = sal.line;
+
while (1)
{
/* Clean up saved state that will become invalid. */
@@ -1222,11 +1233,29 @@ wait_for_inferior ()
break;
}
}
- /* No subroutince call; stop now. */
+ /* No subroutine call; stop now. */
else
{
- stop_step = 1;
- break;
+ if (step_range_end == 1) break; /* Don't do this for stepi/nexti */
+
+ /* We've wandered out of the step range (but we haven't done a
+ subroutine call or return (that's handled elsewhere)). We
+ don't really want to stop until we encounter the start of a
+ new statement. If so, we stop. Otherwise, we reset
+ step_range_start and step_range_end, and just continue. */
+ sal = find_pc_line(stop_pc, 0);
+
+ if (current_line != sal.line
+ && stop_pc == sal.pc) {
+ stop_step = 1;
+ break;
+ } else {
+ /* This is probably not necessary, but it probably makes
+ stepping more efficient, as we avoid calling find_pc_line()
+ for each instruction we step over. */
+ step_range_start = sal.pc;
+ step_range_end = sal.end;
+ }
}
}