aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2003-05-07 18:35:57 +0000
committerJeff Johnston <jjohnstn@redhat.com>2003-05-07 18:35:57 +0000
commite4846b08991e4620706212fda12f422601f5e63a (patch)
tree736aaa6695002b5de9605fd04afe9b7691a42b0d
parent7108c5dc79b72e614bec4f130170343d0311d904 (diff)
downloadgdb-e4846b08991e4620706212fda12f422601f5e63a.zip
gdb-e4846b08991e4620706212fda12f422601f5e63a.tar.gz
gdb-e4846b08991e4620706212fda12f422601f5e63a.tar.bz2
2003-05-07 Jeff Johnston <jjohnstn@redhat.com>
* infrun.c (prev_pc): Move declaration ahead of proceed(). (proceed): Refresh prev_pc value before resuming. (stop_stepping): Remove code to refresh prev_pc.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/infrun.c43
2 files changed, 36 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1124fe9..0088c24 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-07 Jeff Johnston <jjohnstn@redhat.com>
+
+ * infrun.c (prev_pc): Move declaration ahead of proceed().
+ (proceed): Refresh prev_pc value before resuming.
+ (stop_stepping): Remove code to refresh prev_pc.
+
2003-05-06 Kris Warkentin <kewarken@qnx.com>
* nto-tdep.c: Removed stray comment.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9a0c99f..df17968 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -667,6 +667,12 @@ clear_proceed_status (void)
bpstat_clear (&stop_bpstat);
}
+
+/* Record the pc of the program the last time it stopped. This is
+ just used internally by wait_for_inferior, but need to be preserved
+ over calls to it and cleared when the inferior is started. */
+static CORE_ADDR prev_pc;
+
/* Basic routine for continuing the program in various fashions.
ADDR is the address to resume at, or -1 for resume where stopped.
@@ -772,6 +778,30 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
inferior. */
gdb_flush (gdb_stdout);
+ /* Refresh prev_pc value just prior to resuming. This used to be
+ done in stop_stepping, however, setting prev_pc there did not handle
+ scenarios such as inferior function calls or returning from
+ a function via the return command. In those cases, the prev_pc
+ value was not set properly for subsequent commands. The prev_pc value
+ is used to initialize the starting line number in the ecs. With an
+ invalid value, the gdb next command ends up stopping at the position
+ represented by the next line table entry past our start position.
+ On platforms that generate one line table entry per line, this
+ is not a problem. However, on the ia64, the compiler generates
+ extraneous line table entries that do not increase the line number.
+ When we issue the gdb next command on the ia64 after an inferior call
+ or a return command, we often end up a few instructions forward, still
+ within the original line we started.
+
+ An attempt was made to have init_execution_control_state () refresh
+ the prev_pc value before calculating the line number. This approach
+ did not work because on platforms that use ptrace, the pc register
+ cannot be read unless the inferior is stopped. At that point, we
+ are not guaranteed the inferior is stopped and so the read_pc ()
+ call can fail. Setting the prev_pc value here ensures the value is
+ updated correctly when the inferior is stopped. */
+ prev_pc = read_pc ();
+
/* Resume inferior. */
resume (oneproc || step || bpstat_should_step (), stop_signal);
@@ -785,11 +815,6 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
normal_stop ();
}
}
-
-/* Record the pc of the program the last time it stopped. This is
- just used internally by wait_for_inferior, but need to be preserved
- over calls to it and cleared when the inferior is started. */
-static CORE_ADDR prev_pc;
/* Start remote-debugging of a machine over a serial link. */
@@ -2757,14 +2782,6 @@ step_over_function (struct execution_control_state *ecs)
static void
stop_stepping (struct execution_control_state *ecs)
{
- if (target_has_execution)
- {
- /* Assuming the inferior still exists, set these up for next
- time, just like we did above if we didn't break out of the
- loop. */
- prev_pc = read_pc ();
- }
-
/* Let callers know we don't want to wait for the inferior anymore. */
ecs->wait_some_more = 0;
}