+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
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
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);
return 1;
}
\f
-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)
\f
/* This returns the PC of the first insn after the prologue.
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);
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.
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,
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);
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). */
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);
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. */
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);
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)
/* 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);
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. */
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. */
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)
\f
/* Displaced instruction handling. */
/* 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);
}
/* 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. */
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. */
\f
/* 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)
\f
/* Prologue analysis. */
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);
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)
\f
/* 68HC11 & 68HC12 prologue analysis. */
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);
#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)
\f
/* Construct types for ISA-specific registers. */
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);
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)
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);
\f
/* 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)
\f
/* Frames and frame unwinding. */
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);
return extract_unsigned_integer (buf, 4, byte_order);
}
\f
-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;
-}
\f
/* Allocate and initialize a frame cache. */
/* 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);
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,
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. */
/* 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);
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. */
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);
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. */
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. */
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. */
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);
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. */
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. */
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. */
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);
/* 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. */
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);
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)
\f
/* Allocate and initialize a frame cache. */
/* 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);
/* 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,
/* 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);
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. */
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);
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)
\f
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
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);
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. */
/* 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);