2004-05-12 Andrew Cagney <cagney@redhat.com>

* infrun.c (adjust_pc_after_break): Rewrite decr logic,
	eliminate reference to step_sp.
	(struct execution_control_state, init_execution_control_state)
	(handle_inferior_event, keep_going): Delete update_step_sp and
	step_sp.
	* infcmd.c (step_sp): Note that variable is unused.
This commit is contained in:
Andrew Cagney 2004-05-12 18:08:38 +00:00
parent 2f2f4511bd
commit 8aad930bb7
3 changed files with 58 additions and 46 deletions

View File

@ -1,3 +1,12 @@
2004-05-12 Andrew Cagney <cagney@redhat.com>
* infrun.c (adjust_pc_after_break): Rewrite decr logic,
eliminate reference to step_sp.
(struct execution_control_state, init_execution_control_state)
(handle_inferior_event, keep_going): Delete update_step_sp and
step_sp.
* infcmd.c (step_sp): Note that variable is unused.
2004-05-11 Andrew Cagney <cagney@redhat.com> 2004-05-11 Andrew Cagney <cagney@redhat.com>
* infrun.c (step_over_function): Delete function. * infrun.c (step_over_function): Delete function.

View File

@ -187,7 +187,8 @@ CORE_ADDR step_range_end; /* Exclusive */
struct frame_id step_frame_id; struct frame_id step_frame_id;
/* Our notion of the current stack pointer. */ /* Our notion of the current stack pointer. */
/* NOTE: cagney/2004-05-09: This variable is not used and should be
garbage collected. */
CORE_ADDR step_sp; CORE_ADDR step_sp;
enum step_over_calls_kind step_over_calls; enum step_over_calls_kind step_over_calls;

View File

@ -950,7 +950,6 @@ struct execution_control_state
int handling_longjmp; /* FIXME */ int handling_longjmp; /* FIXME */
ptid_t ptid; ptid_t ptid;
ptid_t saved_inferior_ptid; ptid_t saved_inferior_ptid;
int update_step_sp;
int stepping_through_solib_after_catch; int stepping_through_solib_after_catch;
bpstat stepping_through_solib_catchpoints; bpstat stepping_through_solib_catchpoints;
int enable_hw_watchpoints_after_wait; int enable_hw_watchpoints_after_wait;
@ -1102,7 +1101,6 @@ init_execution_control_state (struct execution_control_state *ecs)
ecs->random_signal = 0; ecs->random_signal = 0;
ecs->remove_breakpoints_on_following_step = 0; ecs->remove_breakpoints_on_following_step = 0;
ecs->handling_longjmp = 0; /* FIXME */ ecs->handling_longjmp = 0; /* FIXME */
ecs->update_step_sp = 0;
ecs->stepping_through_solib_after_catch = 0; ecs->stepping_through_solib_after_catch = 0;
ecs->stepping_through_solib_catchpoints = NULL; ecs->stepping_through_solib_catchpoints = NULL;
ecs->enable_hw_watchpoints_after_wait = 0; ecs->enable_hw_watchpoints_after_wait = 0;
@ -1260,7 +1258,7 @@ handle_step_into_function (struct execution_control_state *ecs)
static void static void
adjust_pc_after_break (struct execution_control_state *ecs) adjust_pc_after_break (struct execution_control_state *ecs)
{ {
CORE_ADDR stop_pc; CORE_ADDR breakpoint_pc;
/* If this target does not decrement the PC after breakpoints, then /* If this target does not decrement the PC after breakpoints, then
we have nothing to do. */ we have nothing to do. */
@ -1294,40 +1292,53 @@ adjust_pc_after_break (struct execution_control_state *ecs)
if (ecs->ws.value.sig != TARGET_SIGNAL_TRAP) if (ecs->ws.value.sig != TARGET_SIGNAL_TRAP)
return; return;
/* Find the location where (if we've hit a breakpoint) the breakpoint would /* Find the location where (if we've hit a breakpoint) the
be. */ breakpoint would be. */
stop_pc = read_pc_pid (ecs->ptid) - DECR_PC_AFTER_BREAK; breakpoint_pc = read_pc_pid (ecs->ptid) - DECR_PC_AFTER_BREAK;
/* If we're software-single-stepping, then assume this is a breakpoint. if (SOFTWARE_SINGLE_STEP_P ())
NOTE drow/2004-01-17: This doesn't check that the PC matches, or that {
we're even in the right thread. The software-single-step code needs /* When using software single-step, a SIGTRAP can only indicate
some modernization. an inserted breakpoint. This actually makes things
easier. */
If we're not software-single-stepping, then we first check that there if (singlestep_breakpoints_inserted_p)
is an enabled software breakpoint at this address. If there is, and /* When software single stepping, the instruction at [prev_pc]
we weren't using hardware-single-step, then we've hit the breakpoint. is never a breakpoint, but the instruction following
[prev_pc] (in program execution order) always is. Assume
If we were using hardware-single-step, we check prev_pc; if we just that following instruction was reached and hence a software
stepped over an inserted software breakpoint, then we should decrement breakpoint was hit. */
the PC and eventually report hitting the breakpoint. The prev_pc check write_pc_pid (breakpoint_pc, ecs->ptid);
prevents us from decrementing the PC if we just stepped over a jump else if (software_breakpoint_inserted_here_p (breakpoint_pc))
instruction and landed on the instruction after a breakpoint. /* The inferior was free running (i.e., no single-step
breakpoints inserted) and it hit a software breakpoint. */
The last bit checks that we didn't hit a breakpoint in a signal handler write_pc_pid (breakpoint_pc, ecs->ptid);
without an intervening stop in sigtramp, which is detected by a new }
stack pointer value below any usual function calling stack adjustments. else
{
NOTE drow/2004-01-17: I'm not sure that this is necessary. The check /* When using hardware single-step, a SIGTRAP is reported for
predates checking for software single step at the same time. Also, both a completed single-step and a software breakpoint. Need
if we've moved into a signal handler we should have seen the to differentiate between the two as the latter needs
signal. */ adjusting but the former does not. */
if (currently_stepping (ecs))
if ((SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p) {
|| (software_breakpoint_inserted_here_p (stop_pc) if (prev_pc == breakpoint_pc
&& !(currently_stepping (ecs) && software_breakpoint_inserted_here_p (breakpoint_pc))
&& prev_pc != stop_pc /* Hardware single-stepped a software breakpoint (as
&& !(step_range_end && INNER_THAN (read_sp (), (step_sp - 16)))))) occures when the inferior is resumed with PC pointing
write_pc_pid (stop_pc, ecs->ptid); at not-yet-hit software breakpoint). Since the
breakpoint really is executed, the inferior needs to be
backed up to the breakpoint address. */
write_pc_pid (breakpoint_pc, ecs->ptid);
}
else
{
if (software_breakpoint_inserted_here_p (breakpoint_pc))
/* The inferior was free running (i.e., no hardware
single-step and no possibility of a false SIGTRAP) and
hit a software breakpoint. */
write_pc_pid (breakpoint_pc, ecs->ptid);
}
}
} }
/* Given an execution control state that has been freshly filled in /* Given an execution control state that has been freshly filled in
@ -2410,11 +2421,6 @@ process_event_stop_test:
return; return;
} }
/* We can't update step_sp every time through the loop, because
reading the stack pointer would slow down stepping too much.
But we can update it every time we leave the step range. */
ecs->update_step_sp = 1;
if (step_range_end != 1 if (step_range_end != 1
&& (step_over_calls == STEP_OVER_UNDEBUGGABLE && (step_over_calls == STEP_OVER_UNDEBUGGABLE
|| step_over_calls == STEP_OVER_ALL) || step_over_calls == STEP_OVER_ALL)
@ -2704,10 +2710,6 @@ keep_going (struct execution_control_state *ecs)
/* Save the pc before execution, to compare with pc after stop. */ /* Save the pc before execution, to compare with pc after stop. */
prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */ prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
if (ecs->update_step_sp)
step_sp = read_sp ();
ecs->update_step_sp = 0;
/* If we did not do break;, it means we should keep running the /* If we did not do break;, it means we should keep running the
inferior and not return to debugger. */ inferior and not return to debugger. */