From 27c464e28f467665de5de2ac785ffc2b239a4bd3 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Sat, 31 Jan 2004 19:59:06 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 8 ++++++++ gdb/breakpoint.c | 14 ++++---------- gdb/breakpoint.h | 2 +- gdb/infrun.c | 44 ++++++++------------------------------------ 4 files changed, 21 insertions(+), 47 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0119192edf..c6610fb091 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2004-01-31 Daniel Jacobowitz + * 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. + +2004-01-31 Daniel Jacobowitz + * breakpoint.h: Update copyright years. 2004-01-31 Daniel Jacobowitz diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 109a20a0a5..11827f471f 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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 not_a_sw_breakpoint) /* 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 not_a_sw_breakpoint) 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) diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index b610da0a67..b3253c73c8 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -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). */ diff --git a/gdb/infrun.c b/gdb/infrun.c index da67e4b066..5ab604c903 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1325,6 +1325,11 @@ adjust_pc_after_break (struct execution_control_state *ecs) /* 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_control_state *ecs) 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_control_state *ecs) 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_control_state *ecs) 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; -- 2.11.0