From: Ulrich Weigand Date: Sat, 9 Jun 2007 13:55:51 +0000 (+0000) Subject: 2007-06-09 Markus Deuling X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b798847d060c439bc350e5fbaf6e8d315b18c727;p=binutils-gdb.git 2007-06-09 Markus Deuling * gdbarch.sh (DECR_PC_AFTER_BREAK): Replace by gdbarch_decr_pc_after_break. * tracepoint.c (trace_dump_command): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * linux-thread-db.c (check_event): Likewise. * linux-nat.c (cancel_breakpoints_callback): Likewise. * infrun.c (adjust_pc_after_break, normal_stop): Likewise. * frame.h: Likewise (comment). * dummy-frame.c (deprecated_pc_in_call_dummy): Likewise. * aix-thread.c (aix_thread_wait): Likewise. * gdbarch.c, gdbarch.h: Regenerate. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a6365f160ff..cc1a3a38132 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2007-06-09 Markus Deuling + + * gdbarch.sh (DECR_PC_AFTER_BREAK): Replace by + gdbarch_decr_pc_after_break. + * tracepoint.c (trace_dump_command): Likewise. + * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. + * linux-thread-db.c (check_event): Likewise. + * linux-nat.c (cancel_breakpoints_callback): Likewise. + * infrun.c (adjust_pc_after_break, normal_stop): Likewise. + * frame.h: Likewise (comment). + * dummy-frame.c (deprecated_pc_in_call_dummy): Likewise. + * aix-thread.c (aix_thread_wait): Likewise. + * gdbarch.c, gdbarch.h: Regenerate. + 2007-06-09 Markus Deuling * gdbarch.sh (ADDRESS_CLASS_TYPE_FLAGS): Replace by diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index ccb275a5863..32b7430d568 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -1013,8 +1013,9 @@ aix_thread_wait (ptid_t ptid, struct target_waitstatus *status) /* Check whether libpthdebug might be ready to be initialized. */ if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED && - status->value.sig == TARGET_SIGNAL_TRAP && - read_pc_pid (ptid) - DECR_PC_AFTER_BREAK == pd_brk_addr) + status->value.sig == TARGET_SIGNAL_TRAP + && read_pc_pid (ptid) + - gdbarch_decr_pc_after_break (current_gdbarch) == pd_brk_addr) return pd_activate (0); return pd_update (0); diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index ec6e8b56b93..4308d351061 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -52,7 +52,7 @@ static struct dummy_frame *dummy_frame_stack = NULL; /* Function: deprecated_pc_in_call_dummy (pc) Return non-zero if the PC falls in a dummy frame created by gdb for - an inferior call. The code below which allows DECR_PC_AFTER_BREAK + an inferior call. The code below which allows gdbarch_decr_pc_after_break is for infrun.c, which may give the function a PC without that subtracted out. @@ -75,7 +75,8 @@ deprecated_pc_in_call_dummy (CORE_ADDR pc) dummyframe = dummyframe->next) { if ((pc >= dummyframe->id.code_addr) - && (pc <= dummyframe->id.code_addr + DECR_PC_AFTER_BREAK)) + && (pc <= dummyframe->id.code_addr + + gdbarch_decr_pc_after_break (current_gdbarch))) return 1; } return 0; diff --git a/gdb/frame.h b/gdb/frame.h index b29370ab302..53bb5fa4b01 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -709,7 +709,7 @@ extern struct frame_info *deprecated_safe_get_selected_frame (void); extern struct frame_info *create_new_frame (CORE_ADDR base, CORE_ADDR pc); /* FIXME: cagney/2002-12-06: Has the PC in the current frame changed? - "infrun.c", Thanks to DECR_PC_AFTER_BREAK, can change the PC after + "infrun.c", Thanks to gdbarch_decr_pc_after_break, can change the PC after the initial frame create. This puts things back in sync. This replaced: frame->pc = ....; */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 9edc8abfc6e..f3b894ce001 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -760,11 +760,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: convert_register_p = <0x%lx>\n", (long) current_gdbarch->convert_register_p); -#ifdef DECR_PC_AFTER_BREAK - fprintf_unfiltered (file, - "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n", - XSTRING (DECR_PC_AFTER_BREAK)); -#endif fprintf_unfiltered (file, "gdbarch_dump: decr_pc_after_break = 0x%s\n", paddr_nz (current_gdbarch->decr_pc_after_break)); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 1632a5bc9f6..e195f8a4c63 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -718,12 +718,6 @@ extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbar extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch); extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break); -#if !defined (GDB_TM_FILE) && defined (DECR_PC_AFTER_BREAK) -#error "Non multi-arch definition of DECR_PC_AFTER_BREAK" -#endif -#if !defined (DECR_PC_AFTER_BREAK) -#define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch)) -#endif /* A function can be addressed by either it's "pointer" (possibly a descriptor address) or "entry point" (first executable instruction). diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 4e286c79cb3..81cc07d255b 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -547,7 +547,7 @@ f:=:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, len M::CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr f:=:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0 f:=:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0 -v:=:CORE_ADDR:decr_pc_after_break:::0:::0 +v::CORE_ADDR:decr_pc_after_break:::0:::0 # A function can be addressed by either it's "pointer" (possibly a # descriptor address) or "entry point" (first executable instruction). diff --git a/gdb/infrun.c b/gdb/infrun.c index c6da74678e1..db2c4a9f622 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1148,29 +1148,29 @@ adjust_pc_after_break (struct execution_control_state *ecs) /* If this target does not decrement the PC after breakpoints, then we have nothing to do. */ - if (DECR_PC_AFTER_BREAK == 0) + if (gdbarch_decr_pc_after_break (current_gdbarch) == 0) return; /* 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. + affected by gdbarch_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 clear where the PC is pointing afterwards. It may not match - DECR_PC_AFTER_BREAK. I don't know any specific target that generates - these signals at breakpoints (the code has been in GDB since at least - 1992) so I can not guess how to handle them here. + gdbarch_decr_pc_after_break. I don't know any specific target that + generates these signals at breakpoints (the code has been in GDB since at + least 1992) so I can not guess how to handle them here. In earlier versions of GDB, a target with gdbarch_have_nonsteppable_watchpoint would have the PC after hitting a - watchpoint affected by DECR_PC_AFTER_BREAK. I haven't found any target - with both of these set in GDB history, and it seems unlikely to be correct, - so gdbarch_have_nonsteppable_watchpoint is not checked here. */ + watchpoint affected by gdbarch_decr_pc_after_break. I haven't found any + target with both of these set in GDB history, and it seems unlikely to be + correct, so gdbarch_have_nonsteppable_watchpoint is not checked here. */ if (ecs->ws.kind != TARGET_WAITKIND_STOPPED) return; @@ -1180,7 +1180,8 @@ adjust_pc_after_break (struct execution_control_state *ecs) /* Find the location where (if we've hit a breakpoint) the breakpoint would be. */ - breakpoint_pc = read_pc_pid (ecs->ptid) - DECR_PC_AFTER_BREAK; + breakpoint_pc = read_pc_pid (ecs->ptid) - gdbarch_decr_pc_after_break + (current_gdbarch); if (SOFTWARE_SINGLE_STEP_P ()) { @@ -3083,12 +3084,12 @@ normal_stop (void) /* NOTE drow/2004-01-17: Is this still necessary? */ /* Make sure that the current_frame's pc is correct. This is a correction for setting up the frame info before doing - DECR_PC_AFTER_BREAK */ + gdbarch_decr_pc_after_break */ if (target_has_execution) /* FIXME: cagney/2002-12-06: Has the PC changed? Thanks to - DECR_PC_AFTER_BREAK, the program counter can change. Ask the + gdbarch_decr_pc_after_break, the program counter can change. Ask the frame code to check for this and sort out any resultant mess. - DECR_PC_AFTER_BREAK needs to just go away. */ + gdbarch_decr_pc_after_break needs to just go away. */ deprecated_update_frame_pc_hack (get_current_frame (), read_pc ()); if (target_has_execution && breakpoints_inserted) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 158657e1865..695dbb0bfc0 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1767,7 +1767,8 @@ cancel_breakpoints_callback (struct lwp_info *lp, void *data) if (lp->status != 0 && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) - - DECR_PC_AFTER_BREAK)) + gdbarch_decr_pc_after_break + (current_gdbarch))) { if (debug_linux_nat) fprintf_unfiltered (gdb_stdlog, @@ -1775,8 +1776,10 @@ cancel_breakpoints_callback (struct lwp_info *lp, void *data) target_pid_to_str (lp->ptid)); /* Back up the PC if necessary. */ - if (DECR_PC_AFTER_BREAK) - write_pc_pid (read_pc_pid (lp->ptid) - DECR_PC_AFTER_BREAK, lp->ptid); + if (gdbarch_decr_pc_after_break (current_gdbarch)) + write_pc_pid (read_pc_pid (lp->ptid) - gdbarch_decr_pc_after_break + (current_gdbarch), + lp->ptid); /* Throw away the SIGTRAP. */ lp->status = 0; diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 63bd8525386..eb7bb807206 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -804,7 +804,7 @@ check_event (ptid_t ptid) int loop = 0; /* Bail out early if we're not at a thread event breakpoint. */ - stop_pc = read_pc_pid (ptid) - DECR_PC_AFTER_BREAK; + stop_pc = read_pc_pid (ptid) - gdbarch_decr_pc_after_break (current_gdbarch); if (stop_pc != td_create_bp_addr && stop_pc != td_death_bp_addr) return; diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index b87361e9e16..6f5c5894a50 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -777,9 +777,9 @@ sunos_solib_create_inferior_hook (void) the PC as necessary after a breakpoint, disable the breakpoint, and add any shared libraries that were mapped in. */ - if (DECR_PC_AFTER_BREAK) + if (gdbarch_decr_pc_after_break (current_gdbarch)) { - stop_pc -= DECR_PC_AFTER_BREAK; + stop_pc -= gdbarch_decr_pc_after_break (current_gdbarch); write_register (PC_REGNUM, stop_pc); } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 41d45438e64..a2a073d0d5f 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2584,7 +2584,8 @@ trace_dump_command (char *args, int from_tty) to the tracepoint PC. If not, then the current frame was collected during single-stepping. */ - stepping_frame = (t->address != (read_pc () - DECR_PC_AFTER_BREAK)); + stepping_frame = (t->address != (read_pc () - gdbarch_decr_pc_after_break + (current_gdbarch))); for (action = t->actions; action; action = action->next) {