Add default_breakpoint_from_pc

This patch adds the default implementation of gdbarch breakpoint_from_pc,
which is,

const gdb_byte *
default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
                           int *lenptr)
{
  int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);

  return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
}

so gdbarch can only defines sw_breakpoint_from_kind and
breakpoint_kind_from_pc.

gdb:

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

	* arch-utils.c (default_breakpoint_from_pc): New function.
	* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): Remove.
	(GDBARCH_BREAKPOINT_MANIPULATION): Don't use
	GDBARCH_BREAKPOINT_FROM_PC.
	(SET_GDBARCH_BREAKPOINT_MANIPULATION): Don't call
	set_gdbarch_breakpoint_from_pc.
	(default_breakpoint_from_pc): Remove declaration.
	* gdbarch.sh (breakpoint_from_pc): Add its default implementation.
	* gdbarch.c, gdbarch.h: Regenerate.
	* arm-tdep.c: Don't use GDBARCH_BREAKPOINT_FROM_PC.
	* arc-tdep.c, bfin-tdep.c, cris-tdep.c, iq2000-tdep.c: Likewise.
	* m32r-tdep.c, mips-tdep.c, mt-tdep.c: Likewise.
	* nios2-tdep.c, score-tdep.c, sh-tdep.c: Likewise.
	* sh64-tdep.c, tic6x-tdep.c, v850-tdep.c, xtensa-tdep.c: Likewise.
This commit is contained in:
Yao Qi 2016-11-03 14:35:14 +00:00
parent c0f4a997c2
commit 22f13eb869
20 changed files with 35 additions and 82 deletions

View File

@ -1,3 +1,20 @@
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_from_pc): New function.
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): Remove.
(GDBARCH_BREAKPOINT_MANIPULATION): Don't use
GDBARCH_BREAKPOINT_FROM_PC.
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Don't call
set_gdbarch_breakpoint_from_pc.
(default_breakpoint_from_pc): Remove declaration.
* gdbarch.sh (breakpoint_from_pc): Add its default implementation.
* gdbarch.c, gdbarch.h: Regenerate.
* arm-tdep.c: Don't use GDBARCH_BREAKPOINT_FROM_PC.
* arc-tdep.c, bfin-tdep.c, cris-tdep.c, iq2000-tdep.c: Likewise.
* m32r-tdep.c, mips-tdep.c, mt-tdep.c: Likewise.
* nios2-tdep.c, score-tdep.c, sh-tdep.c: Likewise.
* sh64-tdep.c, tic6x-tdep.c, v850-tdep.c, xtensa-tdep.c: Likewise.
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_remote_breakpoint_from_pc): Remove.

View File

@ -772,8 +772,6 @@ arc_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
GDBARCH_BREAKPOINT_FROM_PC (arc)
/* Implement the "unwind_pc" gdbarch method. */
static CORE_ADDR

View File

@ -840,6 +840,15 @@ default_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr,
return 1;
}
const gdb_byte *
default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
int *lenptr)
{
int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
}
void
default_gen_return_address (struct gdbarch *gdbarch,
struct agent_expr *ax, struct axs_value *value,

View File

@ -26,17 +26,6 @@ struct minimal_symbol;
struct type;
struct gdbarch_info;
#define GDBARCH_BREAKPOINT_FROM_PC(ARCH) \
static const gdb_byte * \
ARCH##_breakpoint_from_pc (struct gdbarch *gdbarch, \
CORE_ADDR *pcptr, \
int *lenptr) \
{ \
int kind = ARCH##_breakpoint_kind_from_pc (gdbarch, pcptr); \
\
return ARCH##_sw_breakpoint_from_kind (gdbarch, kind, lenptr); \
}
#define GDBARCH_BREAKPOINT_MANIPULATION(ARCH,BREAK_INSN) \
static int \
ARCH##_breakpoint_kind_from_pc (struct gdbarch *gdbarch, \
@ -50,11 +39,9 @@ struct gdbarch_info;
{ \
*size = kind; \
return BREAK_INSN; \
} \
GDBARCH_BREAKPOINT_FROM_PC (ARCH)
}
#define SET_GDBARCH_BREAKPOINT_MANIPULATION(ARCH) \
set_gdbarch_breakpoint_from_pc (gdbarch, ARCH##_breakpoint_from_pc); \
set_gdbarch_breakpoint_kind_from_pc (gdbarch, \
ARCH##_breakpoint_kind_from_pc); \
set_gdbarch_sw_breakpoint_from_kind (gdbarch, \
@ -80,8 +67,7 @@ struct gdbarch_info;
return BIG_BREAK_INSN; \
else \
return LITTLE_BREAK_INSN; \
} \
GDBARCH_BREAKPOINT_FROM_PC (ARCH)
}
/* An implementation of gdbarch_displaced_step_copy_insn for
processors that don't need to modify the instruction before
@ -228,6 +214,10 @@ extern int default_has_shared_address_space (struct gdbarch *);
extern int default_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
CORE_ADDR addr, char **msg);
extern const gdb_byte *default_breakpoint_from_pc (struct gdbarch *gdbarch,
CORE_ADDR *pcptr,
int *lenptr);
extern void default_gen_return_address (struct gdbarch *gdbarch,
struct agent_expr *ax,
struct axs_value *value,

View File

@ -7901,16 +7901,6 @@ arm_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
/* Determine the type and size of breakpoint to insert at PCPTR. Uses
the program counter value to determine whether a 16-bit or 32-bit
breakpoint should be used. It returns a pointer to a string of
bytes that encode a breakpoint instruction, stores the length of
the string to *lenptr, and adjusts the program counter (if
necessary) to point to the actual memory location where the
breakpoint should be inserted. */
GDBARCH_BREAKPOINT_FROM_PC (arm)
/* Extract from an array REGBUF containing the (raw) register state a
function return value of type TYPE, and copy that, in virtual
format, into VALBUF. */

View File

@ -601,14 +601,6 @@ bfin_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
return bfin_breakpoint;
}
/* This function implements the 'breakpoint_from_pc' gdbarch method.
It returns a pointer to a string of bytes that encode a breakpoint
instruction, stores the length of the string to *lenptr, and
adjusts the program counter (if necessary) to point to the actual
memory location where the breakpoint should be inserted. */
GDBARCH_BREAKPOINT_FROM_PC (bfin)
static void
bfin_extract_return_value (struct type *type,
struct regcache *regs,

View File

@ -1416,14 +1416,6 @@ cris_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
return break8_insn;
}
/* Use the program counter to determine the contents and size of a breakpoint
instruction. It returns a pointer to a string of bytes that encode a
breakpoint instruction, stores the length of the string to *lenptr, and
adjusts pcptr (if necessary) to point to the actual memory location where
the breakpoint should be inserted. */
GDBARCH_BREAKPOINT_FROM_PC (cris)
/* Returns 1 if spec_reg is applicable to the current gdbarch's CRIS version,
0 otherwise. */

View File

@ -404,6 +404,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->pointer_to_address = unsigned_pointer_to_address;
gdbarch->address_to_pointer = unsigned_address_to_pointer;
gdbarch->return_in_first_hidden_param_p = default_return_in_first_hidden_param_p;
gdbarch->breakpoint_from_pc = default_breakpoint_from_pc;
gdbarch->sw_breakpoint_from_kind = NULL;
gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
@ -582,8 +583,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of skip_entrypoint, has predicate. */
if (gdbarch->inner_than == 0)
fprintf_unfiltered (log, "\n\tinner_than");
if (gdbarch->breakpoint_from_pc == 0)
fprintf_unfiltered (log, "\n\tbreakpoint_from_pc");
/* Skip verify of breakpoint_from_pc, invalid_p == 0 */
if (gdbarch->breakpoint_kind_from_pc == 0)
fprintf_unfiltered (log, "\n\tbreakpoint_kind_from_pc");
/* Skip verify of sw_breakpoint_from_kind, invalid_p == 0 */

View File

@ -559,7 +559,7 @@ M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip
M:CORE_ADDR:skip_entrypoint:CORE_ADDR ip:ip
f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0
m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0:
m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:0:default_breakpoint_from_pc::0
# Return the breakpoint kind for this target based on *PCPTR.
m:int:breakpoint_kind_from_pc:CORE_ADDR *pcptr:pcptr::0:

View File

@ -490,8 +490,6 @@ iq2000_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
== BFD_ENDIAN_BIG) ? big_breakpoint : little_breakpoint;
}
GDBARCH_BREAKPOINT_FROM_PC (iq2000)
/* Target function return value methods: */
/* Function: store_return_value

View File

@ -202,8 +202,6 @@ m32r_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
GDBARCH_BREAKPOINT_FROM_PC (m32r)
char *m32r_register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp",

View File

@ -7122,15 +7122,6 @@ mips_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
};
}
/* This function implements gdbarch_breakpoint_from_pc. It uses the
program counter value to determine whether a 16- or 32-bit breakpoint
should be used. It returns a pointer to a string of bytes that encode a
breakpoint instruction, stores the length of the string to *lenptr, and
adjusts pc (if necessary) to point to the actual memory location where
the breakpoint should be inserted. */
GDBARCH_BREAKPOINT_FROM_PC (mips)
/* Return non-zero if the standard MIPS instruction INST has a branch
delay slot (i.e. it is a jump or branch instruction). This function
is based on mips32_next_pc. */

View File

@ -478,8 +478,6 @@ mt_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
return ms1_breakpoint;
}
GDBARCH_BREAKPOINT_FROM_PC (mt)
/* Select the correct coprocessor register bank. Return the pseudo
regnum we really want to read. */

View File

@ -1772,10 +1772,6 @@ nios2_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
/* Implement the breakpoint_from_pc gdbarch hook. */
GDBARCH_BREAKPOINT_FROM_PC (nios2)
/* Implement the print_insn gdbarch method. */
static int

View File

@ -368,8 +368,6 @@ score7_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
GDBARCH_BREAKPOINT_FROM_PC (score7)
/* Implement the breakpoint_kind_from_pc gdbarch method. */
static int
@ -406,8 +404,6 @@ score3_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
return score_break_insns[index];
}
GDBARCH_BREAKPOINT_FROM_PC (score3)
static CORE_ADDR
score_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
{

View File

@ -454,8 +454,6 @@ sh_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
GDBARCH_BREAKPOINT_FROM_PC (sh)
/* Prologue looks like
mov.l r14,@-r15
sts.l pr,@-r15

View File

@ -306,8 +306,6 @@ sh64_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
GDBARCH_BREAKPOINT_FROM_PC (sh64)
/* Prologue looks like
[mov.l <regs>,@-r15]...
[sts.l pr,@-r15]

View File

@ -346,10 +346,6 @@ tic6x_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
return tdep->breakpoint;
}
/* This is the implementation of gdbarch method breakpiont_from_pc. */
GDBARCH_BREAKPOINT_FROM_PC (tic6x)
/* This is the implementation of gdbarch method print_insn. */
static int

View File

@ -1208,8 +1208,6 @@ v850_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
GDBARCH_BREAKPOINT_FROM_PC (v850)
static struct v850_frame_cache *
v850_alloc_frame_cache (struct frame_info *this_frame)
{

View File

@ -2009,8 +2009,6 @@ xtensa_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
GDBARCH_BREAKPOINT_FROM_PC (xtensa)
/* Call0 ABI support routines. */
/* Return true, if PC points to "ret" or "ret.n". */