garbage collect target_decr_pc_after_break

record-btrace was the only target making use of this, and it no longer
uses it.

gdb/ChangeLog:
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.
This commit is contained in:
Pedro Alves 2015-03-04 20:41:17 +00:00
parent 3e572f7104
commit 527a273ac1
9 changed files with 22 additions and 65 deletions

View File

@ -1,3 +1,17 @@
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> 2015-03-04 Pedro Alves <palves@redhat.com>
* linux-nat.c (save_sigtrap): Check for breakpoints before * linux-nat.c (save_sigtrap): Check for breakpoints before

View File

@ -1042,7 +1042,7 @@ aix_thread_wait (struct target_ops *ops,
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regcache_read_pc (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); return pd_activate (0);
} }

View File

@ -1058,14 +1058,14 @@ cancel_breakpoint (ptid_t ptid)
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR pc; 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)) if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc))
{ {
inferior_debug (4, "cancel_breakpoint for thread 0x%x\n", inferior_debug (4, "cancel_breakpoint for thread 0x%x\n",
ptid_get_tid (ptid)); ptid_get_tid (ptid));
/* Back up the PC if necessary. */ /* 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); regcache_write_pc (regcache, pc);
return 1; return 1;

View File

@ -3485,7 +3485,7 @@ adjust_pc_after_break (struct execution_control_state *ecs)
regcache = get_thread_regcache (ecs->ptid); regcache = get_thread_regcache (ecs->ptid);
gdbarch = get_regcache_arch (regcache); 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) if (decr_pc == 0)
return; 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 /* Re-adjust PC to what the program would see if GDB was not
debugging it. */ debugging it. */
regcache = get_thread_regcache (ecs->event_thread->ptid); 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) if (decr_pc != 0)
{ {
struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL); struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);

View File

@ -2685,7 +2685,7 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
#endif #endif
pc = regcache_read_pc (regcache); 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 USE_SIGTRAP_SIGINFO
if (linux_nat_get_siginfo (lp->ptid, &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 regcache *regcache = get_thread_regcache (lp->ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache); 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) if (decr_pc != 0)
{ {

View File

@ -1439,7 +1439,7 @@ check_event (ptid_t ptid)
/* Bail out early if we're not at a thread event breakpoint. */ /* Bail out early if we're not at a thread event breakpoint. */
stop_pc = regcache_read_pc (regcache); stop_pc = regcache_read_pc (regcache);
if (!target_supports_stopped_by_sw_breakpoint ()) 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 if (stop_pc != info->td_create_bp_addr
&& stop_pc != info->td_death_bp_addr) && stop_pc != info->td_death_bp_addr)

View File

@ -3805,29 +3805,6 @@ debug_get_tailcall_unwinder (struct target_ops *self)
return result; 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 static void
delegate_prepare_to_generate_core (struct target_ops *self) 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; ops->to_get_unwinder = delegate_get_unwinder;
if (ops->to_get_tailcall_unwinder == NULL) if (ops->to_get_tailcall_unwinder == NULL)
ops->to_get_tailcall_unwinder = delegate_get_tailcall_unwinder; 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) if (ops->to_prepare_to_generate_core == NULL)
ops->to_prepare_to_generate_core = delegate_prepare_to_generate_core; ops->to_prepare_to_generate_core = delegate_prepare_to_generate_core;
if (ops->to_done_generating_core == NULL) 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_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read;
ops->to_get_unwinder = tdefault_get_unwinder; ops->to_get_unwinder = tdefault_get_unwinder;
ops->to_get_tailcall_unwinder = tdefault_get_tailcall_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_prepare_to_generate_core = tdefault_prepare_to_generate_core;
ops->to_done_generating_core = tdefault_done_generating_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_augmented_libraries_svr4_read = debug_augmented_libraries_svr4_read;
ops->to_get_unwinder = debug_get_unwinder; ops->to_get_unwinder = debug_get_unwinder;
ops->to_get_tailcall_unwinder = debug_get_tailcall_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_prepare_to_generate_core = debug_prepare_to_generate_core;
ops->to_done_generating_core = debug_done_generating_core; ops->to_done_generating_core = debug_done_generating_core;
} }

View File

@ -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 static enum exec_direction_kind default_execution_direction
(struct target_ops *self); (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; static struct target_ops debug_target;
#include "target-delegates.c" #include "target-delegates.c"
@ -3572,23 +3569,6 @@ target_get_tailcall_unwinder (void)
return current_target.to_get_tailcall_unwinder (&current_target); return current_target.to_get_tailcall_unwinder (&current_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 (&current_target, gdbarch);
}
/* See target.h. */ /* See target.h. */
void void

View File

@ -1157,13 +1157,6 @@ struct target_ops
const struct frame_unwind *(*to_get_tailcall_unwinder) (struct target_ops *self) const struct frame_unwind *(*to_get_tailcall_unwinder) (struct target_ops *self)
TARGET_DEFAULT_RETURN (NULL); 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. */ /* Prepare to generate a core file. */
void (*to_prepare_to_generate_core) (struct target_ops *) void (*to_prepare_to_generate_core) (struct target_ops *)
TARGET_DEFAULT_IGNORE (); TARGET_DEFAULT_IGNORE ();
@ -2328,9 +2321,6 @@ extern void target_call_history_from (ULONGEST begin, int size, int flags);
/* See to_call_history_range. */ /* See to_call_history_range. */
extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags); 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. */ /* See to_prepare_to_generate_core. */
extern void target_prepare_to_generate_core (void); extern void target_prepare_to_generate_core (void);