[patch/rfc] Rewrite decr-pc logic, eliminate step_sp
Andrew Cagney
cagney@gnu.org
Wed May 12 18:04:00 GMT 2004
+ if (currently_stepping (ecs))
+ {
+ if (SOFTWARE_SINGLE_STEP_P ())
+ {
+ if (singlestep_breakpoints_inserted_p
+ && prev_pc == breakpoint_pc)
+ /* If we're software-single-stepping, assume we hit one of
+ the inserted software breakpoints. */
+ write_pc_pid (breakpoint_pc, ecs->ptid);
+ }
I'm pretty sure that won't work. prev_pc is where we were stopped
before we decided to single step. breakpoint_pc is where, if we have
hit a breakpoint, the breakpoint would be. They won't be equal;
breakpoint_pc will be the following instruction, or the target of a
branch if *prev_pc was a taken branch. The old code assumes we hit a
breakpoint if we stopped with SIGTRAP with singlestep_breakpoints_inserted_p
- any reason not to keep that behavior?
It's plain wrong. I'm pretty sure that, when doing the thread-hop, singlestep_breakpoints_inserted_p holds, but current_stepping() doesn't.
I think Alpha OSF/1 and Alpha NetBSD are the only current
software-single-step and decr-pc targets, which makes this case a
little hard to test - at least OSF/1 had dreadful test results already,
I'm not sure about NetBSD. Might want to verify that it isn't
catastrophic, at least.
The rest of it looks right to me, though I had to stare at it for
the last twenty minutes or so.
I gave up staring at the old code, it made no sense.
Attached is a revision.
I've checked this in. In addition to PPC (h/w single step) and i386
(decr pc after break) I gave it a sniff test on alpha GNU/Linux (hacked
to use s/w single step).
Andrew
2004-05-09 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.
More information about the Gdb-patches
mailing list