From 2e6ee069ae81f3b5140059f6b997ccb0dcd1684e Mon Sep 17 00:00:00 2001 From: Antoine Tremblay Date: Fri, 23 Oct 2015 13:20:39 -0400 Subject: Refactor default_breakpoint_kind_from_pc to be used by all targets in GDBServer. This patch moves default_breakpoint_kind_from_pc to target.c and creates a macro so that all targets can easily use it. This allows the breakpoint_kind_from_pc operation to be left unimplemented in targets that do not need it. This is preparation to fix the win32/nto/spu build that was broken by this patch: https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended} gdb/gdbserver/ChangeLog: * linux-low.c (default_breakpoint_kind_from_pc): Move to target.c. * mem-break.c (set_breakpoint_at): Use target_breakpoint_kind_from_pc. * target.c (default_breakpoint_kind_from_pc): Moved from linux-low.c * target.h (target_breakpoint_kind_from_pc): New macro. --- gdb/gdbserver/target.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gdb/gdbserver/target.c') diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 301f90e..80512d86 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -224,3 +224,19 @@ target_can_do_hardware_single_step (void) { return 1; } + +/* Default implementation for breakpoint_kind_for_pc. + + The default behavior for targets that don't implement breakpoint_kind_for_pc + is to use the size of a breakpoint as the kind. */ + +int +default_breakpoint_kind_from_pc (CORE_ADDR *pcptr) +{ + int size = 0; + + gdb_assert (the_target->sw_breakpoint_from_kind != NULL); + + (*the_target->sw_breakpoint_from_kind) (0, &size); + return size; +} -- cgit v1.1