+2015-03-04 Pedro Alves <palves@redhat.com>
+
+ * target.h (struct target_ops) <to_decr_pc_after_break>: 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 <palves@redhat.com>
* linux-nat.c (save_sigtrap): Check for breakpoints before
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);
}
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;
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;
/* 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);
#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))
{
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)
{
/* 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)
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)
{
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)
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;
}
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;
}
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"
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
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 ();
/* 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);