GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION

Many archs have only one kind of breakpoint, so their breakpoint_from_pc
implementations are quite similar.  This patch uses macro
GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION
for breakpoint_from_pc, so that we can easily switch from
breakpoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kind
later.

gdb:

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.
This commit is contained in:
Yao Qi 2016-11-03 14:35:13 +00:00
parent 8b55a7e4e5
commit 598cc9dc84
30 changed files with 147 additions and 272 deletions

View File

@ -1,3 +1,37 @@
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

View File

@ -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);

View File

@ -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);

View File

@ -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.

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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. */

View File

@ -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);

View File

@ -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. */

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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. */

View File

@ -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);

View File

@ -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. */

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);