aboutsummaryrefslogtreecommitdiff
path: root/gdb/sh64-tdep.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-11-03 14:35:13 +0000
committerYao Qi <yao.qi@linaro.org>2016-11-03 14:35:13 +0000
commitd19280adb5b2d1470dc39756ccac8a8fa2af8321 (patch)
treec452ae7ecd2c45f4dfbfe404eb4bd5a7c99aaf28 /gdb/sh64-tdep.c
parent44f1c4d7b0160a51ecf7fe1af42416f1d2a71356 (diff)
downloadgdb-d19280adb5b2d1470dc39756ccac8a8fa2af8321.zip
gdb-d19280adb5b2d1470dc39756ccac8a8fa2af8321.tar.gz
gdb-d19280adb5b2d1470dc39756ccac8a8fa2af8321.tar.bz2
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.
Diffstat (limited to 'gdb/sh64-tdep.c')
-rw-r--r--gdb/sh64-tdep.c71
1 files changed, 37 insertions, 34 deletions
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index f51186a..97e5a58 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -253,11 +253,24 @@ pc_is_isa32 (bfd_vma memaddr)
return 0;
}
-static const unsigned char *
-sh64_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
+static int
+sh64_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
{
- /* The BRK instruction for shmedia is
+ if (pc_is_isa32 (*pcptr))
+ {
+ *pcptr = UNMAKE_ISA32_ADDR (*pcptr);
+ return 4;
+ }
+ else
+ return 2;
+}
+
+static const gdb_byte *
+sh64_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
+{
+ *size = kind;
+
+ /* The BRK instruction for shmedia is
01101111 11110101 11111111 11110000
which translates in big endian mode to 0x6f, 0xf5, 0xff, 0xf0
and in little endian mode to 0xf0, 0xff, 0xf5, 0x6f */
@@ -267,44 +280,34 @@ sh64_breakpoint_from_pc (struct gdbarch *gdbarch,
which translates in big endian mode to 0x0, 0x3b
and in little endian mode to 0x3b, 0x0 */
- if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ if (kind == 4)
{
- if (pc_is_isa32 (*pcptr))
- {
- static unsigned char big_breakpoint_media[] = {
- 0x6f, 0xf5, 0xff, 0xf0
- };
- *pcptr = UNMAKE_ISA32_ADDR (*pcptr);
- *lenptr = sizeof (big_breakpoint_media);
- return big_breakpoint_media;
- }
+ static unsigned char big_breakpoint_media[] = {
+ 0x6f, 0xf5, 0xff, 0xf0
+ };
+ static unsigned char little_breakpoint_media[] = {
+ 0xf0, 0xff, 0xf5, 0x6f
+ };
+
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ return big_breakpoint_media;
else
- {
- static unsigned char big_breakpoint_compact[] = {0x0, 0x3b};
- *lenptr = sizeof (big_breakpoint_compact);
- return big_breakpoint_compact;
- }
+ return little_breakpoint_media;
}
else
{
- if (pc_is_isa32 (*pcptr))
- {
- static unsigned char little_breakpoint_media[] = {
- 0xf0, 0xff, 0xf5, 0x6f
- };
- *pcptr = UNMAKE_ISA32_ADDR (*pcptr);
- *lenptr = sizeof (little_breakpoint_media);
- return little_breakpoint_media;
- }
+ static unsigned char big_breakpoint_compact[] = {0x0, 0x3b};
+ static unsigned char little_breakpoint_compact[] = {0x3b, 0x0};
+
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ return big_breakpoint_compact;
else
- {
- static unsigned char little_breakpoint_compact[] = {0x3b, 0x0};
- *lenptr = sizeof (little_breakpoint_compact);
- return little_breakpoint_compact;
- }
+ return little_breakpoint_compact;
}
}
+GDBARCH_BREAKPOINT_FROM_PC (sh64)
+
/* Prologue looks like
[mov.l <regs>,@-r15]...
[sts.l pr,@-r15]
@@ -2410,7 +2413,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read);
set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write);
- set_gdbarch_breakpoint_from_pc (gdbarch, sh64_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (sh64);
set_gdbarch_print_insn (gdbarch, print_insn_sh);
set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);