[RFA] Don't ignore consecutive breakpoints.

Vladimir Prus
2007-11-23T20:10:28Z

Suppose we have two breakpoints at two consecutive
addresses, and we do "step" while stopped on the
first breakpoint. GDB testsuite has a test (consecutive.exp)
that the second breakpoint will be hit a reported, and the
test passes, but the code directly contradicts, saying:

/* Don't even think about breakpoints if just proceeded over a
breakpoint. */
if (stop_signal == TARGET_SIGNAL_TRAP && trap_expected)
{
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: trap expected\n");
bpstat_clear (&stop_bpstat);
}

what's happening is that we indeed ignore the breakpoint, and try
to step further. However ecs->another_trap is not set, so we step
with breakpoints inserted, and immediately hit the now-inserted
breakpoint. Therefore, I propose to remove that code.

On x86, the below patch causes a single test outcome change:

-KFAIL: gdb.base/watchpoint.exp: next after watch x (PRMS: gdb/38)
+PASS: gdb.base/watchpoint.exp: next after watch x

The test is for a breakpoint set on a line that also triggers a
watchpoint. The outcome changed because we now do check breakpoints
after stepping over breakpoint. The target does not have any
watchpoint stop address, so we read watched value, and find that
in indeed has changed.

OK?

- Volodya

* infrun.c (handle_inferior_event): Don't
ignore beakpoints if trap_expected is set.
---
gdb/infrun.c | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 85d889a..feff6aa 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1983,23 +1983,12 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
}

- /* Don't even think about breakpoints if just proceeded over a
- breakpoint. */
- if (stop_signal == TARGET_SIGNAL_TRAP && trap_expected)
- {
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: trap expected\n");
- bpstat_clear (&stop_bpstat);
- }
- else
- {
- /* See if there is a breakpoint at the current PC. */
- stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
-
- /* Following in case break condition called a
- function. */
- stop_print_frame = 1;
- }
+ /* See if there is a breakpoint at the current PC. */
+ stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+
+ /* Following in case break condition called a
+ function. */
+ stop_print_frame = 1;

/* NOTE: cagney/2003-03-29: These two checks for a random signal
at one stage in the past included checks for an inferior
--
1.5.3.5