aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog34
-rw-r--r--gdb/aarch64-tdep.c12
-rw-r--r--gdb/alpha-tdep.c12
-rw-r--r--gdb/arch-utils.h13
-rw-r--r--gdb/avr-tdep.c13
-rw-r--r--gdb/frv-tdep.c12
-rw-r--r--gdb/ft32-tdep.c13
-rw-r--r--gdb/h8300-tdep.c14
-rw-r--r--gdb/hppa-tdep.c12
-rw-r--r--gdb/i386-tdep.c11
-rw-r--r--gdb/lm32-tdep.c12
-rw-r--r--gdb/m32c-tdep.c13
-rw-r--r--gdb/m68hc11-tdep.c13
-rw-r--r--gdb/m68k-tdep.c13
-rw-r--r--gdb/m88k-tdep.c15
-rw-r--r--gdb/mep-tdep.c12
-rw-r--r--gdb/microblaze-tdep.c13
-rw-r--r--gdb/mips-tdep.c2
-rw-r--r--gdb/mn10300-tdep.c12
-rw-r--r--gdb/moxie-tdep.c14
-rw-r--r--gdb/msp430-tdep.c14
-rw-r--r--gdb/nds32-tdep.c22
-rw-r--r--gdb/rl78-tdep.c22
-rw-r--r--gdb/rx-tdep.c13
-rw-r--r--gdb/s390-linux-tdep.c14
-rw-r--r--gdb/sparc-tdep.c12
-rw-r--r--gdb/spu-tdep.c13
-rw-r--r--gdb/tilegx-tdep.c18
-rw-r--r--gdb/vax-tdep.c13
-rw-r--r--gdb/xstormy16-tdep.c13
30 files changed, 147 insertions, 272 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92fdd69..7ae7359 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,39 @@
2016-11-03 Yao Qi <yao.qi@linaro.org>
+ * arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): New macro.
+ (SET_GDBARCH_BREAKPOINT_MANIPULATION): New macro.
+ aarch64-tdep.c (aarch64_breakpoint_from_pc): Remove. Use
+ GDBARCH_BREAKPOINT_MANIPULATION.
+ (aarch64_gdbarch_init): Replace set_gdbarch_breakpoint_from_pc
+ with SET_GDBARCH_BREAKPOINT_MANIPULATION.
+ * alpha-tdep.c: Likewise.
+ * avr-tdep.c: Likewise.
+ * frv-tdep.c: Likewise.
+ * ft32-tdep.c: Likewise.
+ * h8300-tdep.c: Likewise.
+ * hppa-tdep.c: Likewise.
+ * i386-tdep.c: Likewise.
+ * lm32-tdep.c: Likewise.
+ * m32c-tdep.c: Likewise.
+ * m68hc11-tdep.c: Likewise.
+ * m68k-tdep.c: Likewise.
+ * m88k-tdep.c: Likewise.
+ * mep-tdep.c: Likewise.
+ * microblaze-tdep.c: Likewise.
+ * mn10300-tdep.c: Likewise.
+ * moxie-tdep.c: Likewise.
+ * msp430-tdep.c: Likewise.
+ * rl78-tdep.c: Likewise.
+ * rx-tdep.c: Likewise.
+ * s390-linux-tdep.c: Likewise.
+ * sparc-tdep.c: Likewise.
+ * spu-tdep.c: Likewise.
+ * tilegx-tdep.c: Likewise.
+ * vax-tdep.c: Likewise.
+ * xstormy16-tdep.c: Likewise.
+
+2016-11-03 Yao Qi <yao.qi@linaro.org>
+
* mem-break.c (default_memory_insert_breakpoint): Don't check
'bp' against NULL.
* microblaze-linux-tdep.c (microblaze_linux_memory_remove_breakpoint):
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index be72785..304d9df 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1592,15 +1592,7 @@ aarch64_gdb_print_insn (bfd_vma memaddr, disassemble_info *info)
1101.0100.0010.0000.0000.0000.0000.0000 = 0xd4200000. */
static const gdb_byte aarch64_default_breakpoint[] = {0x00, 0x00, 0x20, 0xd4};
-/* Implement the "breakpoint_from_pc" gdbarch method. */
-
-static const gdb_byte *
-aarch64_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- *lenptr = sizeof (aarch64_default_breakpoint);
- return aarch64_default_breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (aarch64, aarch64_default_breakpoint)
/* Extract from an array REGS containing the (raw) register state a
function return value of type TYPE, and copy that, in virtual
@@ -2762,7 +2754,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Breakpoint manipulation. */
- set_gdbarch_breakpoint_from_pc (gdbarch, aarch64_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (aarch64);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
set_gdbarch_software_single_step (gdbarch, aarch64_software_single_step);
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 8716fd8..58e6ee3 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -645,14 +645,10 @@ alpha_return_in_memory_always (struct type *type)
return 1;
}
-static const gdb_byte *
-alpha_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- static const gdb_byte break_insn[] = { 0x80, 0, 0, 0 }; /* call_pal bpt */
- *len = sizeof(break_insn);
- return break_insn;
-}
+static const gdb_byte break_insn[] = { 0x80, 0, 0, 0 }; /* call_pal bpt */
+
+GDBARCH_BREAKPOINT_MANIPULATION (alpha, break_insn)
/* This returns the PC of the first insn after the prologue.
@@ -1822,7 +1818,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_gdbarch_breakpoint_from_pc (gdbarch, alpha_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (alpha);
set_gdbarch_decr_pc_after_break (gdbarch, ALPHA_INSN_SIZE);
set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index bbb0878..5bf6da5 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -26,6 +26,19 @@ struct minimal_symbol;
struct type;
struct gdbarch_info;
+#define GDBARCH_BREAKPOINT_MANIPULATION(ARCH,BREAK_INSN) \
+ static const gdb_byte * \
+ ARCH##_breakpoint_from_pc (struct gdbarch *gdbarch, \
+ CORE_ADDR *pcptr, \
+ int *lenptr) \
+ { \
+ *lenptr = sizeof (BREAK_INSN); \
+ return BREAK_INSN; \
+ }
+
+#define SET_GDBARCH_BREAKPOINT_MANIPULATION(ARCH) \
+ set_gdbarch_breakpoint_from_pc (gdbarch, ARCH##_breakpoint_from_pc)
+
/* An implementation of gdbarch_displaced_step_copy_insn for
processors that don't need to modify the instruction before
single-stepping the displaced copy.
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 71e401b..066bba4 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -913,14 +913,9 @@ avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
it as a NOP. Thus, it should be ok. Since the avr is currently a remote
only target, this shouldn't be a problem (I hope). TRoth/2003-05-14 */
-static const unsigned char *
-avr_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
-{
- static const unsigned char avr_break_insn [] = { 0x98, 0x95 };
- *lenptr = sizeof (avr_break_insn);
- return avr_break_insn;
-}
+static const unsigned char avr_break_insn [] = { 0x98, 0x95 };
+
+GDBARCH_BREAKPOINT_MANIPULATION (avr, avr_break_insn)
/* Determine, for architecture GDBARCH, how a return value of TYPE
should be returned. If it is supposed to be returned in registers,
@@ -1514,7 +1509,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, avr_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (avr);
frame_unwind_append_unwinder (gdbarch, &avr_frame_unwind);
frame_base_set_default (gdbarch, &avr_frame_base);
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 7ce08c0..89d26d0 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -424,13 +424,9 @@ frv_register_sim_regno (struct gdbarch *gdbarch, int reg)
internal_error (__FILE__, __LINE__, _("Bad register number %d"), reg);
}
-static const unsigned char *
-frv_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenp)
-{
- static unsigned char breakpoint[] = {0xc0, 0x70, 0x00, 0x01};
- *lenp = sizeof (breakpoint);
- return breakpoint;
-}
+static const unsigned char breakpoint[] = {0xc0, 0x70, 0x00, 0x01};
+
+GDBARCH_BREAKPOINT_MANIPULATION (frv, breakpoint)
/* Define the maximum number of instructions which may be packed into a
bundle (VLIW instruction). */
@@ -1537,7 +1533,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue);
set_gdbarch_skip_main_prologue (gdbarch, frv_skip_main_prologue);
- set_gdbarch_breakpoint_from_pc (gdbarch, frv_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (frv);
set_gdbarch_adjust_breakpoint_address
(gdbarch, frv_adjust_breakpoint_address);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index d7c2b40..bd907c4 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -78,17 +78,10 @@ ft32_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return sp & ~1;
}
-/* Implement the "breakpoint_from_pc" gdbarch method. */
-static const unsigned char *
-ft32_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
-{
- static const gdb_byte breakpoint[] = { 0x02, 0x00, 0x34, 0x00 };
+static const gdb_byte breakpoint[] = { 0x02, 0x00, 0x34, 0x00 };
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (ft32, breakpoint)
/* FT32 register names. */
@@ -631,7 +624,7 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, ft32_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, ft32_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (ft32);
set_gdbarch_frame_align (gdbarch, ft32_frame_align);
frame_base_set_default (gdbarch, &ft32_frame_base);
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 951f005..5e757a9 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1242,16 +1242,10 @@ h8300s_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
return regno;
}
-static const unsigned char *
-h8300_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- /*static unsigned char breakpoint[] = { 0x7A, 0xFF }; *//* ??? */
- static unsigned char breakpoint[] = { 0x01, 0x80 }; /* Sleep */
+/*static unsigned char breakpoint[] = { 0x7A, 0xFF }; *//* ??? */
+static const unsigned char breakpoint[] = { 0x01, 0x80 }; /* Sleep */
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (h8300, breakpoint)
static struct gdbarch *
h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
@@ -1377,7 +1371,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Stack grows up. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (h8300);
set_gdbarch_push_dummy_call (gdbarch, h8300_push_dummy_call);
set_gdbarch_char_signed (gdbarch, 0);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index b74ff67..4fef5e7 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -604,13 +604,9 @@ hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
}
-static const unsigned char *
-hppa_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- static const unsigned char breakpoint[] = {0x00, 0x01, 0x00, 0x04};
- (*len) = sizeof (breakpoint);
- return breakpoint;
-}
+static const unsigned char breakpoint[] = {0x00, 0x01, 0x00, 0x04};
+
+GDBARCH_BREAKPOINT_MANIPULATION (hppa, breakpoint)
/* Return the name of a register. */
@@ -3186,7 +3182,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
internal_error (__FILE__, __LINE__, _("bad switch"));
}
- set_gdbarch_breakpoint_from_pc (gdbarch, hppa_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (hppa);
set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
/* Frame unwind methods. */
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index da8ff8e..697edc6 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -588,14 +588,9 @@ static const char *disassembly_flavor = att_flavor;
This function is 64-bit safe. */
-static const gdb_byte *
-i386_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- static gdb_byte break_insn[] = { 0xcc }; /* int 3 */
+static const gdb_byte break_insn[] = { 0xcc }; /* int 3 */
- *len = sizeof (break_insn);
- return break_insn;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (i386, break_insn)
/* Displaced instruction handling. */
@@ -8458,7 +8453,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, i386_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (i386);
set_gdbarch_decr_pc_after_break (gdbarch, 1);
set_gdbarch_max_insn_length (gdbarch, I386_MAX_INSN_LEN);
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index bb9a297..89f13e0 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -216,16 +216,10 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
}
/* Create a breakpoint instruction. */
+static const gdb_byte breakpoint[4] = { OP_RAISE << 2, 0, 0, 2 };
-static const gdb_byte *
-lm32_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- static const gdb_byte breakpoint[4] = { OP_RAISE << 2, 0, 0, 2 };
+GDBARCH_BREAKPOINT_MANIPULATION (lm32, breakpoint)
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
/* Setup registers and stack for faking a call to a function in the
inferior. */
@@ -563,7 +557,7 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
/* Breakpoints. */
- set_gdbarch_breakpoint_from_pc (gdbarch, lm32_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (lm32);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
/* Calling functions in the inferior. */
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index adfa873..da99eae 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -990,16 +990,9 @@ make_regs (struct gdbarch *arch)
/* Breakpoints. */
+static const unsigned char break_insn[] = { 0x00 }; /* brk */
-static const unsigned char *
-m32c_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- static unsigned char break_insn[] = { 0x00 }; /* brk */
-
- *len = sizeof (break_insn);
- return break_insn;
-}
-
+GDBARCH_BREAKPOINT_MANIPULATION (m32c, break_insn)
/* Prologue analysis. */
@@ -2652,7 +2645,7 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, print_insn_m32c);
/* Breakpoints. */
- set_gdbarch_breakpoint_from_pc (gdbarch, m32c_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (m32c);
/* Prologue analysis and unwinding. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index c30e682..620d1fb 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -390,16 +390,9 @@ m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr)
return m68hc11_register_names[reg_nr];
}
-static const unsigned char *
-m68hc11_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- static unsigned char breakpoint[] = {0x0};
-
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
+static unsigned char breakpoint[] = {0x0};
+GDBARCH_BREAKPOINT_MANIPULATION (m68hc11, breakpoint)
/* 68HC11 & 68HC12 prologue analysis. */
@@ -1528,7 +1521,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_return_value (gdbarch, m68hc11_return_value);
set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (m68hc11);
set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11);
m68hc11_add_reggroups (gdbarch);
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 5d7b65d..cea2f01 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -57,14 +57,9 @@
#define BPT_VECTOR 0xf
#endif
-static const gdb_byte *
-m68k_local_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
-{
- static gdb_byte break_insn[] = {0x4e, (0x40 | BPT_VECTOR)};
- *lenptr = sizeof (break_insn);
- return break_insn;
-}
+static gdb_byte break_insn[] = {0x4e, (0x40 | BPT_VECTOR)};
+
+GDBARCH_BREAKPOINT_MANIPULATION (m68k, break_insn)
/* Construct types for ISA-specific registers. */
@@ -1196,7 +1191,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_double_bit (gdbarch, long_double_format[0]->totalsize);
set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
- set_gdbarch_breakpoint_from_pc (gdbarch, m68k_local_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (m68k);
/* Stack grows down. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index e8e19df..48deb53 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -97,16 +97,11 @@ m88k_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
encode a breakpoint instruction, store the length of the string in
*LEN and optionally adjust *PC to point to the correct memory
location for inserting the breakpoint. */
-
-static const gdb_byte *
-m88k_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- /* tb 0,r0,511 */
- static gdb_byte break_insn[] = { 0xf0, 0x00, 0xd1, 0xff };
- *len = sizeof (break_insn);
- return break_insn;
-}
+/* tb 0,r0,511 */
+static gdb_byte break_insn[] = { 0xf0, 0x00, 0xd1, 0xff };
+
+GDBARCH_BREAKPOINT_MANIPULATION (m88k, break_insn)
static CORE_ADDR
m88k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -857,7 +852,7 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_return_value (gdbarch, m88k_return_value);
set_gdbarch_addr_bits_remove (gdbarch, m88k_addr_bits_remove);
- set_gdbarch_breakpoint_from_pc (gdbarch, m88k_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (m88k);
set_gdbarch_unwind_pc (gdbarch, m88k_unwind_pc);
set_gdbarch_write_pc (gdbarch, m88k_write_pc);
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index a110b04..a8900f1 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -1918,15 +1918,9 @@ mep_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Breakpoints. */
+static unsigned char breakpoint[] = { 0x70, 0x32 };
-static const unsigned char *
-mep_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR * pcptr, int *lenptr)
-{
- static unsigned char breakpoint[] = { 0x70, 0x32 };
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
-
+GDBARCH_BREAKPOINT_MANIPULATION (mep, breakpoint)
/* Frames and frame unwinding. */
@@ -2490,7 +2484,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, mep_gdb_print_insn);
/* Breakpoints. */
- set_gdbarch_breakpoint_from_pc (gdbarch, mep_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (mep);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_skip_prologue (gdbarch, mep_skip_prologue);
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 665ec0c..ea33ae7 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -134,15 +134,10 @@ microblaze_fetch_instruction (CORE_ADDR pc)
return extract_unsigned_integer (buf, 4, byte_order);
}
-static const gdb_byte *
-microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc,
- int *len)
-{
- static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT;
+static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT;
+
+GDBARCH_BREAKPOINT_MANIPULATION (microblaze, break_insn)
- *len = sizeof (break_insn);
- return break_insn;
-}
/* Allocate and initialize a frame cache. */
@@ -736,7 +731,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (microblaze);
set_gdbarch_frame_args_skip (gdbarch, 8);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 962f9ca..e4b60c0 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -8729,7 +8729,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_value_to_register (gdbarch, mips_value_to_register);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, mips_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (mips);
set_gdbarch_remote_breakpoint_from_pc (gdbarch,
mips_remote_breakpoint_from_pc);
set_gdbarch_adjust_breakpoint_address (gdbarch,
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 9ef88a8..16c0b39 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -322,15 +322,9 @@ mn10300_write_pc (struct regcache *regcache, CORE_ADDR val)
The Matsushita mn10x00 processors have single byte instructions
so we need a single byte breakpoint. Matsushita hasn't defined
one, so we defined it ourselves. */
+static gdb_byte breakpoint[] = {0xff};
-static const unsigned char *
-mn10300_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
- int *bp_size)
-{
- static gdb_byte breakpoint[] = {0xff};
- *bp_size = 1;
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (mn10300, breakpoint)
/* Model the semantics of pushing a register onto the stack. This
is a helper function for mn10300_analyze_prologue, below. */
@@ -1444,7 +1438,7 @@ mn10300_gdbarch_init (struct gdbarch_info info,
/* Stack unwinding. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Breakpoints. */
- set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (mn10300);
/* decr_pc_after_break? */
/* Disassembly. */
set_gdbarch_print_insn (gdbarch, print_insn_mn10300);
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 5e5c19b..8d29bdf 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -68,17 +68,9 @@ moxie_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return sp & ~1;
}
-/* Implement the "breakpoint_from_pc" gdbarch method. */
+static unsigned char breakpoint[] = { 0x35, 0x00 };
-static const unsigned char *
-moxie_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
-{
- static unsigned char breakpoint[] = { 0x35, 0x00 };
-
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (moxie, breakpoint)
/* Moxie register names. */
@@ -1139,7 +1131,7 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, moxie_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, moxie_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (moxie);
set_gdbarch_frame_align (gdbarch, moxie_frame_align);
frame_base_set_default (gdbarch, &moxie_frame_base);
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 84189dc..8043155 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -277,17 +277,9 @@ msp430_register_sim_regno (struct gdbarch *gdbarch, int regnum)
return regnum;
}
-/* Implement the "breakpoint_from_pc" gdbarch method. */
+static gdb_byte breakpoint[] = { 0x43, 0x43 };
-static const gdb_byte *
-msp430_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- static gdb_byte breakpoint[] = { 0x43, 0x43 };
-
- *lenptr = sizeof breakpoint;
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (msp430, breakpoint)
/* Define a "handle" struct for fetching the next opcode. */
@@ -1001,7 +993,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
/* Breakpoints. */
- set_gdbarch_breakpoint_from_pc (gdbarch, msp430_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (msp430);
set_gdbarch_decr_pc_after_break (gdbarch, 1);
/* Disassembly. */
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 0ec443a..618a482 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -281,24 +281,10 @@ nds32_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return align_down (sp, 8);
}
-/* Implement the "breakpoint_from_pc" gdbarch method.
+/* The same insn machine code is used for little-endian and big-endian. */
+static const gdb_byte break_insn[] = { 0xEA, 0x00 };
- Use the program counter to determine the contents and size of a
- breakpoint instruction. Return a pointer to a string of bytes that
- encode a breakpoint instruction, store the length of the string in
- *LENPTR and optionally adjust *PCPTR to point to the correct memory
- location for inserting the breakpoint. */
-
-static const gdb_byte *
-nds32_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- /* The same insn machine code is used for little-endian and big-endian. */
- static const gdb_byte break_insn[] = { 0xEA, 0x00 };
-
- *lenptr = sizeof (break_insn);
- return break_insn;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (nds32, break_insn)
/* Implement the "dwarf2_reg_to_regnum" gdbarch method. */
@@ -2157,7 +2143,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, nds32_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, nds32_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (nds32);
set_gdbarch_frame_align (gdbarch, nds32_frame_align);
frame_base_set_default (gdbarch, &nds32_frame_base);
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 4818d38..1e9d435 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -768,21 +768,13 @@ rl78_pseudo_register_write (struct gdbarch *gdbarch,
gdb_assert_not_reached ("invalid pseudo register number");
}
-/* Implement the "breakpoint_from_pc" gdbarch method. */
+/* The documented BRK instruction is actually a two byte sequence,
+ {0x61, 0xcc}, but instructions may be as short as one byte.
+ Correspondence with Renesas revealed that the one byte sequence
+ 0xff is used when a one byte breakpoint instruction is required. */
+static gdb_byte breakpoint[] = { 0xff };
-static const gdb_byte *
-rl78_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- /* The documented BRK instruction is actually a two byte sequence,
- {0x61, 0xcc}, but instructions may be as short as one byte.
- Correspondence with Renesas revealed that the one byte sequence
- 0xff is used when a one byte breakpoint instruction is required. */
- static gdb_byte breakpoint[] = { 0xff };
-
- *lenptr = sizeof breakpoint;
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (rl78, breakpoint)
/* Define a "handle" struct for fetching the next opcode. */
@@ -1460,7 +1452,7 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_addr_bits_remove (gdbarch, rl78_addr_bits_remove);
/* Breakpoints. */
- set_gdbarch_breakpoint_from_pc (gdbarch, rl78_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (rl78);
set_gdbarch_decr_pc_after_break (gdbarch, 1);
/* Disassembly. */
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 5d55a98..fa91af9 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -992,14 +992,9 @@ rx_return_value (struct gdbarch *gdbarch,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-/* Implement the "breakpoint_from_pc" gdbarch method. */
-static const gdb_byte *
-rx_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
-{
- static gdb_byte breakpoint[] = { 0x00 };
- *lenptr = sizeof breakpoint;
- return breakpoint;
-}
+static gdb_byte breakpoint[] = { 0x00 };
+
+GDBARCH_BREAKPOINT_MANIPULATION (rx, breakpoint)
/* Implement the dwarf_reg_to_regnum" gdbarch method. */
@@ -1097,7 +1092,7 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sp_regnum (gdbarch, RX_SP_REGNUM);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_decr_pc_after_break (gdbarch, 1);
- set_gdbarch_breakpoint_from_pc (gdbarch, rx_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (rx);
set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue);
set_gdbarch_print_insn (gdbarch, print_insn_rx);
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 399084a..f654e25 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -3550,17 +3550,9 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
/* Breakpoints. */
+static const gdb_byte breakpoint[] = { 0x0, 0x1 };
-static const gdb_byte *
-s390_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
-{
- static const gdb_byte breakpoint[] = { 0x0, 0x1 };
-
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
-
+GDBARCH_BREAKPOINT_MANIPULATION (s390, breakpoint)
/* Address handling. */
@@ -7983,7 +7975,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_decr_pc_after_break (gdbarch, 2);
/* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (s390);
set_gdbarch_software_single_step (gdbarch, s390_software_single_step);
set_gdbarch_displaced_step_hw_singlestep (gdbarch, s390_displaced_step_hw_singlestep);
set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue);
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index f50468b..abeec80 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -641,15 +641,9 @@ sparc32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
encode a breakpoint instruction, store the length of the string in
*LEN and optionally adjust *PC to point to the correct memory
location for inserting the breakpoint. */
-
-static const gdb_byte *
-sparc_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- static const gdb_byte break_insn[] = { 0x91, 0xd0, 0x20, 0x01 };
+static const gdb_byte break_insn[] = { 0x91, 0xd0, 0x20, 0x01 };
- *len = sizeof (break_insn);
- return break_insn;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (sparc, break_insn)
/* Allocate and initialize a frame cache. */
@@ -1709,7 +1703,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, sparc_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (sparc);
set_gdbarch_frame_args_skip (gdbarch, 8);
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index f62e8e7..1863da1 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1570,16 +1570,9 @@ spu_return_value (struct gdbarch *gdbarch, struct value *function,
/* Breakpoints. */
+static const gdb_byte breakpoint[] = { 0x00, 0x00, 0x3f, 0xff };
-static const gdb_byte *
-spu_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR * pcptr, int *lenptr)
-{
- static const gdb_byte breakpoint[] = { 0x00, 0x00, 0x3f, 0xff };
-
- *lenptr = sizeof breakpoint;
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (spu, breakpoint)
static int
spu_memory_remove_breakpoint (struct gdbarch *gdbarch,
@@ -2797,7 +2790,7 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Breakpoints. */
set_gdbarch_decr_pc_after_break (gdbarch, 4);
- set_gdbarch_breakpoint_from_pc (gdbarch, spu_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (spu);
set_gdbarch_memory_remove_breakpoint (gdbarch, spu_memory_remove_breakpoint);
set_gdbarch_software_single_step (gdbarch, spu_software_single_step);
set_gdbarch_get_longjmp_target (gdbarch, spu_get_longjmp_target);
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 94ed401..ea03688 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -842,19 +842,11 @@ tilegx_write_pc (struct regcache *regcache, CORE_ADDR pc)
INT_SWINT_1_SIGRETURN);
}
-/* This is the implementation of gdbarch method breakpoint_from_pc. */
+/* 64-bit pattern for a { bpt ; nop } bundle. */
+static const unsigned char breakpoint[] =
+ { 0x00, 0x50, 0x48, 0x51, 0xae, 0x44, 0x6a, 0x28 };
-static const unsigned char *
-tilegx_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
-{
- /* 64-bit pattern for a { bpt ; nop } bundle. */
- static const unsigned char breakpoint[] =
- { 0x00, 0x50, 0x48, 0x51, 0xae, 0x44, 0x6a, 0x28 };
-
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
+GDBARCH_BREAKPOINT_MANIPULATION (tilegx, breakpoint)
/* Normal frames. */
@@ -1057,7 +1049,7 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_push_dummy_call (gdbarch, tilegx_push_dummy_call);
set_gdbarch_get_longjmp_target (gdbarch, tilegx_get_longjmp_target);
set_gdbarch_write_pc (gdbarch, tilegx_write_pc);
- set_gdbarch_breakpoint_from_pc (gdbarch, tilegx_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (tilegx);
set_gdbarch_return_value (gdbarch, tilegx_return_value);
set_gdbarch_print_insn (gdbarch, print_insn_tilegx);
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index b7f4185..861f807 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -251,15 +251,10 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
encode a breakpoint instruction, store the length of the string in
*LEN and optionally adjust *PC to point to the correct memory
location for inserting the breakpoint. */
-
-static const gdb_byte *
-vax_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- static gdb_byte break_insn[] = { 3 };
- *len = sizeof (break_insn);
- return break_insn;
-}
+static gdb_byte break_insn[] = { 3 };
+
+GDBARCH_BREAKPOINT_MANIPULATION (vax, break_insn)
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
@@ -500,7 +495,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_dummy_id (gdbarch, vax_dummy_id);
/* Breakpoint info */
- set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (vax);
/* Misc info */
set_gdbarch_deprecated_function_start_offset (gdbarch, 2);
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index af1551f..b2f0c5e 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -506,14 +506,9 @@ xstormy16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
}
-static const unsigned char *
-xstormy16_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
- int *lenptr)
-{
- static unsigned char breakpoint[] = { 0x06, 0x0 };
- *lenptr = sizeof (breakpoint);
- return breakpoint;
-}
+static unsigned char breakpoint[] = { 0x06, 0x0 };
+
+GDBARCH_BREAKPOINT_MANIPULATION (xstormy16, breakpoint)
/* Given a pointer to a jump table entry, return the address
of the function it jumps to. Return 0 if not found. */
@@ -843,7 +838,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* These values and methods are used when gdb calls a target function. */
set_gdbarch_push_dummy_call (gdbarch, xstormy16_push_dummy_call);
- set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
+ SET_GDBARCH_BREAKPOINT_MANIPULATION (xstormy16);
set_gdbarch_return_value (gdbarch, xstormy16_return_value);
set_gdbarch_skip_trampoline_code (gdbarch, xstormy16_skip_trampoline_code);