+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.
}
}
-GDBARCH_BREAKPOINT_FROM_PC (arc)
-
/* Implement the "unwind_pc" gdbarch method. */
static CORE_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,
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, \
{ \
*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, \
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
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,
}
}
-/* 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. */
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,
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. */
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;
/* 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 */
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:
== BFD_ENDIAN_BIG) ? big_breakpoint : little_breakpoint;
}
-GDBARCH_BREAKPOINT_FROM_PC (iq2000)
-
/* Target function return value methods: */
/* Function: store_return_value
}
}
-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",
};
}
-/* 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. */
return ms1_breakpoint;
}
-GDBARCH_BREAKPOINT_FROM_PC (mt)
-
/* Select the correct coprocessor register bank. Return the pseudo
regnum we really want to read. */
}
}
-/* Implement the breakpoint_from_pc gdbarch hook. */
-
-GDBARCH_BREAKPOINT_FROM_PC (nios2)
-
/* Implement the print_insn gdbarch method. */
static int
}
}
-GDBARCH_BREAKPOINT_FROM_PC (score7)
-
/* Implement the breakpoint_kind_from_pc gdbarch method. */
static int
return score_break_insns[index];
}
-GDBARCH_BREAKPOINT_FROM_PC (score3)
-
static CORE_ADDR
score_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
{
}
}
-GDBARCH_BREAKPOINT_FROM_PC (sh)
-
/* Prologue looks like
mov.l r14,@-r15
sts.l pr,@-r15
}
}
-GDBARCH_BREAKPOINT_FROM_PC (sh64)
-
/* Prologue looks like
[mov.l <regs>,@-r15]...
[sts.l pr,@-r15]
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
}
}
-GDBARCH_BREAKPOINT_FROM_PC (v850)
-
static struct v850_frame_cache *
v850_alloc_frame_cache (struct frame_info *this_frame)
{
}
}
-GDBARCH_BREAKPOINT_FROM_PC (xtensa)
-
/* Call0 ABI support routines. */
/* Return true, if PC points to "ret" or "ret.n". */