Split breakpoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind

We convert each ARCH_breakpoint_from_pc to ARCH_breakpoint_kind_from_pc
and ARCH_sw_breakpoint_from_kind.  Note that gdbarch doesn't have methods
breakpoint_kind_from_pc and sw_breakpoint_from_kind so far.

gdb:

2016-11-03  Yao Qi  <yao.qi@linaro.org>

	* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): New macro.
	(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): New macro.
	* arm-tdep.c (arm_breakpoint_from_pc): Remove.
	(arm_breakpoint_kind_from_pc): New function.
	(arm_sw_breakpoint_from_kind): New function.
	(arm_breakpoint_from_pc): Call arm_breakpoint_kind_from_pc
	and arm_sw_breakpoint_from_kind.
	Use GDBARCH_BREAKPOINT_FROM_PC.
	(arm_remote_breakpoint_from_pc): Call
	arm_breakpoint_kind_from_pc.
	(arm_gdbarch_init): Replace set_gdbarch_breakpoint_from_pc
	with SET_GDBARCH_BREAKPOINT_MANIPULATION.
	* arc-tdep.c: Likewise.
	* bfin-tdep.c: Likewise.
	* cris-tdep.c: Likewise.
	* iq2000-tdep.c: Likewise.
	* m32r-tdep.c: Likewise.
	* mips-tdep.c: Likewise.
	* mt-tdep.c: Likewise.
	* nios2-tdep.c: Likewise.
	* rs6000-tdep.c: Likewise.
	* score-tdep.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* tic6x-tdep.c: Likewise.
	* v850-tdep.c: Likewise.
	* xtensa-tdep.c: Likewise.
This commit is contained in:
Yao Qi
2016-11-03 14:35:13 +00:00
parent 44f1c4d7b0
commit d19280adb5
18 changed files with 529 additions and 393 deletions

View File

@@ -26,6 +26,17 @@ struct minimal_symbol;
struct type;
struct gdbarch_info;
#define GDBARCH_BREAKPOINT_FROM_PC(ARCH) \
static const gdb_byte * \
ARCH##_breakpoint_from_pc (struct gdbarch *gdbarch, \
CORE_ADDR *pcptr, \
int *lenptr) \
{ \
int kind = ARCH##_breakpoint_kind_from_pc (gdbarch, pcptr); \
\
return ARCH##_sw_breakpoint_from_kind (gdbarch, kind, lenptr); \
}
#define GDBARCH_BREAKPOINT_MANIPULATION(ARCH,BREAK_INSN) \
static const gdb_byte * \
ARCH##_breakpoint_from_pc (struct gdbarch *gdbarch, \
@@ -39,6 +50,23 @@ struct gdbarch_info;
#define SET_GDBARCH_BREAKPOINT_MANIPULATION(ARCH) \
set_gdbarch_breakpoint_from_pc (gdbarch, ARCH##_breakpoint_from_pc)
#define GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN(ARCH, \
LITTLE_BREAK_INSN, \
BIG_BREAK_INSN) \
static const gdb_byte * \
ARCH##_breakpoint_from_pc (struct gdbarch *gdbarch, \
CORE_ADDR *pcptr, \
int *lenptr) \
{ \
gdb_static_assert (ARRAY_SIZE (LITTLE_BREAK_INSN) \
== ARRAY_SIZE (BIG_BREAK_INSN)); \
*lenptr = sizeof (LITTLE_BREAK_INSN); \
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) \
return BIG_BREAK_INSN; \
else \
return LITTLE_BREAK_INSN; \
}
/* An implementation of gdbarch_displaced_step_copy_insn for
processors that don't need to modify the instruction before
single-stepping the displaced copy.