summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-11-03 14:35:14 +0000
committerYao Qi <yao.qi@linaro.org>2016-11-03 14:35:14 +0000
commit22f13eb869197fc45a0da2a8a96b03d39809862e (patch)
tree599a43da86c343773d10954267d7efbe516dff76
parentc0f4a997c26760d2584946196ee5c411d1a632a6 (diff)
downloadbinutils-gdb-22f13eb869197fc45a0da2a8a96b03d39809862e.tar.gz
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.
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/arc-tdep.c2
-rw-r--r--gdb/arch-utils.c9
-rw-r--r--gdb/arch-utils.h22
-rw-r--r--gdb/arm-tdep.c10
-rw-r--r--gdb/bfin-tdep.c8
-rw-r--r--gdb/cris-tdep.c8
-rw-r--r--gdb/gdbarch.c4
-rwxr-xr-xgdb/gdbarch.sh2
-rw-r--r--gdb/iq2000-tdep.c2
-rw-r--r--gdb/m32r-tdep.c2
-rw-r--r--gdb/mips-tdep.c9
-rw-r--r--gdb/mt-tdep.c2
-rw-r--r--gdb/nios2-tdep.c4
-rw-r--r--gdb/score-tdep.c4
-rw-r--r--gdb/sh-tdep.c2
-rw-r--r--gdb/sh64-tdep.c2
-rw-r--r--gdb/tic6x-tdep.c4
-rw-r--r--gdb/v850-tdep.c2
-rw-r--r--gdb/xtensa-tdep.c2
20 files changed, 35 insertions, 82 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3e742ac9bce..313e24c1f2f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,22 @@
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.
* arch-utils.h (default_remote_breakpoint_from_pc): Remove.
* arm-tdep.c (arm_remote_breakpoint_from_pc): Remove.
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index fe8d38d082f..f310da9c866 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -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
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 72156fd5ffe..39e8eb53e4d 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -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,
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index ab558e2c805..791725db977 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -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,
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 3f21299bcb3..ac989447041 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -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. */
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index c75858ba985..989912e911c 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -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,
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index b202730d974..3103f1c7e6a 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -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. */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index a1e311ba188..1a3acabd49a 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -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 */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index e410e657bb2..e3ead6b440c 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -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:
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index ecd90747846..874fc6a8bfd 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -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
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index f5aecbd05a5..c493e2d53a8 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -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",
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 6a254f500dd..9eb2de15d4e 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -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. */
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index ffc03fbab81..a34023f0f47 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -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. */
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 2c569c63564..97b422a7055 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -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
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 715a092eb4e..1bba20b87d4 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -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)
{
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 51a846b0d7d..27795ba0134 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -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
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 97e5a587f1e..80df8b9aafc 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -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]
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 6b166f13ac3..d278e80d806 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -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
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 85392a24a51..27e67a49cb1 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -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)
{
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index a9959460527..8eef5cb9c43 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -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". */