diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1efb9447e2..94ea6caefe 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2015-03-04 Pedro Alves + + * target.h (struct target_ops) : Delete. + (target_decr_pc_after_break): Delete declaration. + * target.c (default_target_decr_pc_after_break) + (target_decr_pc_after_break): Delete. + * linux-nat.c (check_stopped_by_breakpoint, linux_nat_wait_1): Use + gdbarch_decr_pc_after_break instead of target_decr_pc_after_break. + * linux-thread-db.c (check_event): Likewise. + * infrun.c (adjust_pc_after_break): Likewise. + * darwin-nat.c (cancel_breakpoint): Likewise. + * aix-thread.c (aix_thread_wait): Likewise. + * target-delegates.c: Regenerate. + 2015-03-04 Pedro Alves * linux-nat.c (save_sigtrap): Check for breakpoints before diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index b03716b949..e97f793911 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -1042,7 +1042,7 @@ aix_thread_wait (struct target_ops *ops, struct gdbarch *gdbarch = get_regcache_arch (regcache); if (regcache_read_pc (regcache) - - target_decr_pc_after_break (gdbarch) == pd_brk_addr) + - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr) return pd_activate (0); } diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 070f307f62..e1acc05757 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1058,14 +1058,14 @@ cancel_breakpoint (ptid_t ptid) struct gdbarch *gdbarch = get_regcache_arch (regcache); CORE_ADDR pc; - pc = regcache_read_pc (regcache) - target_decr_pc_after_break (gdbarch); + pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch); if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc)) { inferior_debug (4, "cancel_breakpoint for thread 0x%x\n", ptid_get_tid (ptid)); /* Back up the PC if necessary. */ - if (target_decr_pc_after_break (gdbarch)) + if (gdbarch_decr_pc_after_break (gdbarch)) regcache_write_pc (regcache, pc); return 1; diff --git a/gdb/infrun.c b/gdb/infrun.c index 8d3a9bf86d..b8c5d8e07c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3485,7 +3485,7 @@ adjust_pc_after_break (struct execution_control_state *ecs) regcache = get_thread_regcache (ecs->ptid); gdbarch = get_regcache_arch (regcache); - decr_pc = target_decr_pc_after_break (gdbarch); + decr_pc = gdbarch_decr_pc_after_break (gdbarch); if (decr_pc == 0) return; @@ -4537,7 +4537,7 @@ handle_signal_stop (struct execution_control_state *ecs) /* Re-adjust PC to what the program would see if GDB was not debugging it. */ regcache = get_thread_regcache (ecs->event_thread->ptid); - decr_pc = target_decr_pc_after_break (gdbarch); + decr_pc = gdbarch_decr_pc_after_break (gdbarch); if (decr_pc != 0) { struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index af77df22db..4a5a066721 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -2685,7 +2685,7 @@ check_stopped_by_breakpoint (struct lwp_info *lp) #endif pc = regcache_read_pc (regcache); - sw_bp_pc = pc - target_decr_pc_after_break (gdbarch); + sw_bp_pc = pc - gdbarch_decr_pc_after_break (gdbarch); #if USE_SIGTRAP_SIGINFO if (linux_nat_get_siginfo (lp->ptid, &siginfo)) @@ -3460,7 +3460,7 @@ linux_nat_wait_1 (struct target_ops *ops, { struct regcache *regcache = get_thread_regcache (lp->ptid); struct gdbarch *gdbarch = get_regcache_arch (regcache); - int decr_pc = target_decr_pc_after_break (gdbarch); + int decr_pc = gdbarch_decr_pc_after_break (gdbarch); if (decr_pc != 0) { diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 29b52b3326..f7f0d38139 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -1439,7 +1439,7 @@ check_event (ptid_t ptid) /* Bail out early if we're not at a thread event breakpoint. */ stop_pc = regcache_read_pc (regcache); if (!target_supports_stopped_by_sw_breakpoint ()) - stop_pc -= target_decr_pc_after_break (gdbarch); + stop_pc -= gdbarch_decr_pc_after_break (gdbarch); if (stop_pc != info->td_create_bp_addr && stop_pc != info->td_death_bp_addr) diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 1f827f5125..0c1309a9aa 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -3805,29 +3805,6 @@ debug_get_tailcall_unwinder (struct target_ops *self) return result; } -static CORE_ADDR -delegate_decr_pc_after_break (struct target_ops *self, struct gdbarch *arg1) -{ - self = self->beneath; - return self->to_decr_pc_after_break (self, arg1); -} - -static CORE_ADDR -debug_decr_pc_after_break (struct target_ops *self, struct gdbarch *arg1) -{ - CORE_ADDR result; - fprintf_unfiltered (gdb_stdlog, "-> %s->to_decr_pc_after_break (...)\n", debug_target.to_shortname); - result = debug_target.to_decr_pc_after_break (&debug_target, arg1); - fprintf_unfiltered (gdb_stdlog, "<- %s->to_decr_pc_after_break (", debug_target.to_shortname); - target_debug_print_struct_target_ops_p (&debug_target); - fputs_unfiltered (", ", gdb_stdlog); - target_debug_print_struct_gdbarch_p (arg1); - fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_CORE_ADDR (result); - fputs_unfiltered ("\n", gdb_stdlog); - return result; -} - static void delegate_prepare_to_generate_core (struct target_ops *self) { @@ -4155,8 +4132,6 @@ install_delegators (struct target_ops *ops) ops->to_get_unwinder = delegate_get_unwinder; if (ops->to_get_tailcall_unwinder == NULL) ops->to_get_tailcall_unwinder = delegate_get_tailcall_unwinder; - if (ops->to_decr_pc_after_break == NULL) - ops->to_decr_pc_after_break = delegate_decr_pc_after_break; if (ops->to_prepare_to_generate_core == NULL) ops->to_prepare_to_generate_core = delegate_prepare_to_generate_core; if (ops->to_done_generating_core == NULL) @@ -4306,7 +4281,6 @@ install_dummy_methods (struct target_ops *ops) ops->to_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read; ops->to_get_unwinder = tdefault_get_unwinder; ops->to_get_tailcall_unwinder = tdefault_get_tailcall_unwinder; - ops->to_decr_pc_after_break = default_target_decr_pc_after_break; ops->to_prepare_to_generate_core = tdefault_prepare_to_generate_core; ops->to_done_generating_core = tdefault_done_generating_core; } @@ -4454,7 +4428,6 @@ init_debug_target (struct target_ops *ops) ops->to_augmented_libraries_svr4_read = debug_augmented_libraries_svr4_read; ops->to_get_unwinder = debug_get_unwinder; ops->to_get_tailcall_unwinder = debug_get_tailcall_unwinder; - ops->to_decr_pc_after_break = debug_decr_pc_after_break; ops->to_prepare_to_generate_core = debug_prepare_to_generate_core; ops->to_done_generating_core = debug_done_generating_core; } diff --git a/gdb/target.c b/gdb/target.c index 569c999009..d66560a310 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -105,9 +105,6 @@ static char *default_pid_to_str (struct target_ops *ops, ptid_t ptid); static enum exec_direction_kind default_execution_direction (struct target_ops *self); -static CORE_ADDR default_target_decr_pc_after_break (struct target_ops *ops, - struct gdbarch *gdbarch); - static struct target_ops debug_target; #include "target-delegates.c" @@ -3572,23 +3569,6 @@ target_get_tailcall_unwinder (void) return current_target.to_get_tailcall_unwinder (¤t_target); } -/* Default implementation of to_decr_pc_after_break. */ - -static CORE_ADDR -default_target_decr_pc_after_break (struct target_ops *ops, - struct gdbarch *gdbarch) -{ - return gdbarch_decr_pc_after_break (gdbarch); -} - -/* See target.h. */ - -CORE_ADDR -target_decr_pc_after_break (struct gdbarch *gdbarch) -{ - return current_target.to_decr_pc_after_break (¤t_target, gdbarch); -} - /* See target.h. */ void diff --git a/gdb/target.h b/gdb/target.h index a7c2e82a17..c95e1a4711 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1157,13 +1157,6 @@ struct target_ops const struct frame_unwind *(*to_get_tailcall_unwinder) (struct target_ops *self) TARGET_DEFAULT_RETURN (NULL); - /* Return the number of bytes by which the PC needs to be decremented - after executing a breakpoint instruction. - Defaults to gdbarch_decr_pc_after_break (GDBARCH). */ - CORE_ADDR (*to_decr_pc_after_break) (struct target_ops *ops, - struct gdbarch *gdbarch) - TARGET_DEFAULT_FUNC (default_target_decr_pc_after_break); - /* Prepare to generate a core file. */ void (*to_prepare_to_generate_core) (struct target_ops *) TARGET_DEFAULT_IGNORE (); @@ -2328,9 +2321,6 @@ extern void target_call_history_from (ULONGEST begin, int size, int flags); /* See to_call_history_range. */ extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags); -/* See to_decr_pc_after_break. */ -extern CORE_ADDR target_decr_pc_after_break (struct gdbarch *gdbarch); - /* See to_prepare_to_generate_core. */ extern void target_prepare_to_generate_core (void);