This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[ob] Update arguments to bpstat_stop_status
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 31 Jan 2004 15:00:14 -0500
- Subject: [ob] Update arguments to bpstat_stop_status
Obvious followup to the DECR_PC_AFTER_BREAK patch. We don't need the PC to
be a reference argument anymore, or to pass the not_a_sw_breakpoint flag.
All comments are conserved into adjust_pc_after_break.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-01-31 Daniel Jacobowitz <drow@mvista.com>
* breakpoint.c (bpstat_stop_status): Remove not_a_sw_breakpoint
argument, and change first argument to a CORE_ADDR.
* breakpoint.h (bpstat_stop_status): Update prototype.
* infrun.c (adjust_pc_after_break): Add a new comment.
(handle_inferior_event): Update calls to bpstat_stop_status.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.154
diff -u -p -r1.154 breakpoint.c
--- breakpoint.c 31 Jan 2004 19:18:13 -0000 1.154
+++ breakpoint.c 31 Jan 2004 19:56:43 -0000
@@ -2570,11 +2570,8 @@ which its expression is valid.\n");
}
}
-/* Get a bpstat associated with having just stopped at address *PC
- and frame address CORE_ADDRESS. Update *PC to point at the
- breakpoint (if we hit a breakpoint). NOT_A_SW_BREAKPOINT is nonzero
- if this is known to not be a real breakpoint (it could still be a
- watchpoint, though). */
+/* Get a bpstat associated with having just stopped at address
+ BP_ADDR. */
/* Determine whether we stopped at a breakpoint, etc, or whether we
don't understand this stop. Result is a chain of bpstat's such that:
@@ -2591,10 +2588,9 @@ which its expression is valid.\n");
commands, FIXME??? fields. */
bpstat
-bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
+bpstat_stop_status (CORE_ADDR bp_addr)
{
struct breakpoint *b, *temp;
- CORE_ADDR bp_addr;
/* True if we've hit a breakpoint (as opposed to a watchpoint). */
int real_breakpoint = 0;
/* Root of the chain of bpstat's */
@@ -2602,8 +2598,6 @@ bpstat_stop_status (CORE_ADDR *pc, int n
/* Pointer to the last thing in the chain currently. */
bpstat bs = root_bs;
- bp_addr = *pc;
-
ALL_BREAKPOINTS_SAFE (b, temp)
{
if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
@@ -2630,7 +2624,7 @@ bpstat_stop_status (CORE_ADDR *pc, int n
if (b->type == bp_hardware_breakpoint)
{
- if (b->loc->address != *pc)
+ if (b->loc->address != bp_addr)
continue;
if (overlay_debugging /* unmapped overlay section */
&& section_is_overlay (b->loc->section)
Index: breakpoint.h
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.h,v
retrieving revision 1.28
diff -u -p -r1.28 breakpoint.h
--- breakpoint.h 31 Jan 2004 19:24:18 -0000 1.28
+++ breakpoint.h 31 Jan 2004 19:56:43 -0000
@@ -403,7 +403,7 @@ extern void bpstat_clear (bpstat *);
is part of the bpstat is copied as well. */
extern bpstat bpstat_copy (bpstat);
-extern bpstat bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint);
+extern bpstat bpstat_stop_status (CORE_ADDR pc);
/* This bpstat_what stuff tells wait_for_inferior what to do with a
breakpoint (a challenging task). */
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.132
diff -u -p -r1.132 infrun.c
--- infrun.c 31 Jan 2004 19:18:13 -0000 1.132
+++ infrun.c 31 Jan 2004 19:56:44 -0000
@@ -1325,6 +1325,11 @@ adjust_pc_after_break (struct execution_
/* If we've hit a breakpoint, we'll normally be stopped with SIGTRAP. If
we aren't, just return.
+
+ We assume that waitkinds other than TARGET_WAITKIND_STOPPED are not
+ affected by DECR_PC_AFTER_BREAK. Other waitkinds which are implemented
+ by software breakpoints should be handled through the normal breakpoint
+ layer.
NOTE drow/2004-01-31: On some targets, breakpoints may generate
different signals (SIGILL or SIGEMT for instance), but it is less
@@ -1584,13 +1589,7 @@ handle_inferior_event (struct execution_
stop_pc = read_pc ();
- /* Assume that catchpoints are not really software breakpoints. If
- some future target implements them using software breakpoints then
- that target is responsible for fudging DECR_PC_AFTER_BREAK. Thus
- we pass 1 for the NOT_A_SW_BREAKPOINT argument, so that
- bpstat_stop_status will not decrement the PC. */
-
- stop_bpstat = bpstat_stop_status (&stop_pc, 1);
+ stop_bpstat = bpstat_stop_status (stop_pc);
ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
@@ -1639,13 +1638,7 @@ handle_inferior_event (struct execution_
ecs->saved_inferior_ptid = inferior_ptid;
inferior_ptid = ecs->ptid;
- /* Assume that catchpoints are not really software breakpoints. If
- some future target implements them using software breakpoints then
- that target is responsible for fudging DECR_PC_AFTER_BREAK. Thus
- we pass 1 for the NOT_A_SW_BREAKPOINT argument, so that
- bpstat_stop_status will not decrement the PC. */
-
- stop_bpstat = bpstat_stop_status (&stop_pc, 1);
+ stop_bpstat = bpstat_stop_status (stop_pc);
ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
inferior_ptid = ecs->saved_inferior_ptid;
@@ -2035,29 +2028,8 @@ handle_inferior_event (struct execution_
else
{
/* See if there is a breakpoint at the current PC. */
+ stop_bpstat = bpstat_stop_status (stop_pc);
- /* The second argument of bpstat_stop_status is meant to help
- distinguish between a breakpoint trap and a singlestep trap.
- This is only important on targets where DECR_PC_AFTER_BREAK
- is non-zero. The prev_pc test is meant to distinguish between
- singlestepping a trap instruction, and singlestepping thru a
- jump to the instruction following a trap instruction.
-
- Therefore, pass TRUE if our reason for stopping is
- something other than hitting a breakpoint. We do this by
- checking that either: we detected earlier a software single
- step trap or, 1) stepping is going on and 2) we didn't hit
- a breakpoint in a signal handler without an intervening stop
- in sigtramp, which is detected by a new stack pointer value
- below any usual function calling stack adjustments. */
- stop_bpstat =
- bpstat_stop_status
- (&stop_pc,
- sw_single_step_trap_p
- || (currently_stepping (ecs)
- && prev_pc != stop_pc - DECR_PC_AFTER_BREAK
- && !(step_range_end
- && INNER_THAN (read_sp (), (step_sp - 16)))));
/* Following in case break condition called a
function. */
stop_print_frame = 1;