mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-03 04:12:10 +08:00
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind
This patch adds two gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind, and uses target_info.placed_size as "kind" of the breakpoint. This patch updates the usages of target_info.placed_size. The "kind" of a breakpoint is determined by gdbarch rather than target, so we have gdbarch method breakpoint_kind_from_pc, and we should set target_info.placed_size out of each implementation of target to_insert_breakpoint. In this way, each target doesn't have to set target_info.placed_size any more. This patch also sets target_info.placed_address before target_insert_breakpoint too, so that target to_insert_breakpoint can use it, see record_full_insert_breakpoint. Before we call target_insert_breakpoint, we set target_info.placed_address and target_info.placed_size like this, CORE_ADDR addr = bl->target_info.reqstd_address; bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr); bl->target_info.placed_address = addr; return target_insert_breakpoint (bl->gdbarch, &bl->target_info); target_insert_breakpoint may fail, but it doesn't matter to the "kind" and "placed_address" of a breakpoint. They should be determined by gdbarch. gdb: 2016-11-03 Yao Qi <yao.qi@linaro.org> * arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define breakpoint_kind_from_pc and sw_breakpoint_from_kind. (GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise. (SET_GDBARCH_BREAKPOINT_MANIPULATION): Call set_gdbarch_breakpoint_kind_from_pc and set_gdbarch_sw_breakpoint_from_kind. * arm-tdep.c: Add comments. * bfin-tdep.c: Likewise. * breakpoint.c (breakpoint_kind): New function. (insert_bp_location): Set target_info.placed_size and target_info.placed_address. (bkpt_insert_location): Likewise. * cris-tdep.c: Add comments. * gdbarch.sh (breakpoint_kind_from_pc): New. (sw_breakpoint_from_kind): New. * gdbarch.c, gdbarch.h: Regenerated. * ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set bp_tgt->placed_size. (ia64_memory_remove_breakpoint): Don't assert bp_tgt->placed_size. (ia64_breakpoint_kind_from_pc): New function. (ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc. * m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set bp_tgt->placed_size. * mem-break.c (default_memory_insert_breakpoint): Don't set bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind. (default_memory_remove_breakpoint): Call gdbarch_sw_breakpoint_from_kind. (memory_validate_breakpoint): Don't check bp_tgt->placed_size. * mips-tdep.c: Add comments. * mt-tdep.c: Likewise. * nios2-tdep.c: Likewise. * record-full.c (record_full_insert_breakpoint): Don't call gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address and bp_tgt->placed_size. * remote.c (remote_insert_breakpoint): Don't call gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size. Don't set bp_tgt->placed_address and bp_tgt->placed_size. (remote_insert_hw_breakpoint): Likewise. * score-tdep.c: Likewise. * sh-tdep.c: Likewise. * tic6x-tdep.c: Likewise. * v850-tdep.c: Likewise. * xtensa-tdep.c: Likewise.
This commit is contained in:
parent
d19280adb5
commit
cd6c3b4ffc
@ -1,3 +1,50 @@
|
||||
2016-11-03 Yao Qi <yao.qi@linaro.org>
|
||||
|
||||
* arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define
|
||||
breakpoint_kind_from_pc and sw_breakpoint_from_kind.
|
||||
(GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise.
|
||||
(SET_GDBARCH_BREAKPOINT_MANIPULATION): Call
|
||||
set_gdbarch_breakpoint_kind_from_pc and
|
||||
set_gdbarch_sw_breakpoint_from_kind.
|
||||
* arm-tdep.c: Add comments.
|
||||
* bfin-tdep.c: Likewise.
|
||||
* breakpoint.c (breakpoint_kind): New function.
|
||||
(insert_bp_location): Set target_info.placed_size and
|
||||
target_info.placed_address.
|
||||
(bkpt_insert_location): Likewise.
|
||||
* cris-tdep.c: Add comments.
|
||||
* gdbarch.sh (breakpoint_kind_from_pc): New.
|
||||
(sw_breakpoint_from_kind): New.
|
||||
* gdbarch.c, gdbarch.h: Regenerated.
|
||||
* ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set
|
||||
bp_tgt->placed_size.
|
||||
(ia64_memory_remove_breakpoint): Don't assert
|
||||
bp_tgt->placed_size.
|
||||
(ia64_breakpoint_kind_from_pc): New function.
|
||||
(ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc.
|
||||
* m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set
|
||||
bp_tgt->placed_size.
|
||||
* mem-break.c (default_memory_insert_breakpoint): Don't set
|
||||
bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind.
|
||||
(default_memory_remove_breakpoint): Call
|
||||
gdbarch_sw_breakpoint_from_kind.
|
||||
(memory_validate_breakpoint): Don't check bp_tgt->placed_size.
|
||||
* mips-tdep.c: Add comments.
|
||||
* mt-tdep.c: Likewise.
|
||||
* nios2-tdep.c: Likewise.
|
||||
* record-full.c (record_full_insert_breakpoint): Don't call
|
||||
gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address
|
||||
and bp_tgt->placed_size.
|
||||
* remote.c (remote_insert_breakpoint): Don't call
|
||||
gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size.
|
||||
Don't set bp_tgt->placed_address and bp_tgt->placed_size.
|
||||
(remote_insert_hw_breakpoint): Likewise.
|
||||
* score-tdep.c: Likewise.
|
||||
* sh-tdep.c: Likewise.
|
||||
* tic6x-tdep.c: Likewise.
|
||||
* v850-tdep.c: Likewise.
|
||||
* xtensa-tdep.c: Likewise.
|
||||
|
||||
2016-11-03 Yao Qi <yao.qi@linaro.org>
|
||||
|
||||
* arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): New macro.
|
||||
|
@ -38,34 +38,50 @@ 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) \
|
||||
static int \
|
||||
ARCH##_breakpoint_kind_from_pc (struct gdbarch *gdbarch, \
|
||||
CORE_ADDR *pcptr) \
|
||||
{ \
|
||||
*lenptr = sizeof (BREAK_INSN); \
|
||||
return sizeof (BREAK_INSN); \
|
||||
} \
|
||||
static const gdb_byte * \
|
||||
ARCH##_sw_breakpoint_from_kind (struct gdbarch *gdbarch, \
|
||||
int kind, int *size) \
|
||||
{ \
|
||||
*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)
|
||||
#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, \
|
||||
ARCH##_sw_breakpoint_from_kind)
|
||||
|
||||
#define GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN(ARCH, \
|
||||
LITTLE_BREAK_INSN, \
|
||||
BIG_BREAK_INSN) \
|
||||
static const gdb_byte * \
|
||||
ARCH##_breakpoint_from_pc (struct gdbarch *gdbarch, \
|
||||
CORE_ADDR *pcptr, \
|
||||
int *lenptr) \
|
||||
static int \
|
||||
ARCH##_breakpoint_kind_from_pc (struct gdbarch *gdbarch, \
|
||||
CORE_ADDR *pcptr) \
|
||||
{ \
|
||||
gdb_static_assert (ARRAY_SIZE (LITTLE_BREAK_INSN) \
|
||||
== ARRAY_SIZE (BIG_BREAK_INSN)); \
|
||||
*lenptr = sizeof (LITTLE_BREAK_INSN); \
|
||||
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) \
|
||||
return BIG_BREAK_INSN; \
|
||||
else \
|
||||
return LITTLE_BREAK_INSN; \
|
||||
}
|
||||
return sizeof (BIG_BREAK_INSN); \
|
||||
} \
|
||||
static const gdb_byte * \
|
||||
ARCH##_sw_breakpoint_from_kind (struct gdbarch *gdbarch, \
|
||||
int kind, int *size) \
|
||||
{ \
|
||||
*size = kind; \
|
||||
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) \
|
||||
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
|
||||
|
@ -7843,6 +7843,8 @@ static const gdb_byte arm_default_arm_be_breakpoint[] = ARM_BE_BREAKPOINT;
|
||||
static const gdb_byte arm_default_thumb_le_breakpoint[] = THUMB_LE_BREAKPOINT;
|
||||
static const gdb_byte arm_default_thumb_be_breakpoint[] = THUMB_BE_BREAKPOINT;
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
arm_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -7876,6 +7878,8 @@ arm_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
arm_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -568,6 +568,8 @@ bfin_reg_to_regnum (struct gdbarch *gdbarch, int reg)
|
||||
return map_gcc_gdb[reg];
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
bfin_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -583,6 +585,8 @@ bfin_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
bfin_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -2603,6 +2603,14 @@ build_target_command_list (struct bp_location *bl)
|
||||
bl->target_info.persist = 1;
|
||||
}
|
||||
|
||||
/* Return the kind of breakpoint on address *ADDR. */
|
||||
|
||||
static int
|
||||
breakpoint_kind (struct bp_location *bl, CORE_ADDR *addr)
|
||||
{
|
||||
return gdbarch_breakpoint_kind_from_pc (bl->gdbarch, addr);
|
||||
}
|
||||
|
||||
/* Insert a low-level "breakpoint" of some type. BL is the breakpoint
|
||||
location. Any error messages are printed to TMP_ERROR_STREAM; and
|
||||
DISABLED_BREAKS, and HW_BREAKPOINT_ERROR are used to report problems.
|
||||
@ -2762,6 +2770,9 @@ insert_bp_location (struct bp_location *bl,
|
||||
{
|
||||
int val;
|
||||
|
||||
bl->overlay_target_info.placed_size
|
||||
= breakpoint_kind (bl, &addr);
|
||||
bl->overlay_target_info.placed_address = addr;
|
||||
val = target_insert_breakpoint (bl->gdbarch,
|
||||
&bl->overlay_target_info);
|
||||
if (val)
|
||||
@ -13113,6 +13124,11 @@ bkpt_re_set (struct breakpoint *b)
|
||||
static int
|
||||
bkpt_insert_location (struct bp_location *bl)
|
||||
{
|
||||
CORE_ADDR addr = bl->target_info.reqstd_address;
|
||||
|
||||
bl->target_info.placed_size = breakpoint_kind (bl, &addr);
|
||||
bl->target_info.placed_address = addr;
|
||||
|
||||
if (bl->loc_type == bp_loc_hardware_breakpoint)
|
||||
return target_insert_hw_breakpoint (bl->gdbarch, &bl->target_info);
|
||||
else
|
||||
|
@ -1391,12 +1391,16 @@ cris_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||
return sp;
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
cris_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
cris_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -230,6 +230,8 @@ struct gdbarch
|
||||
gdbarch_skip_entrypoint_ftype *skip_entrypoint;
|
||||
gdbarch_inner_than_ftype *inner_than;
|
||||
gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
|
||||
gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc;
|
||||
gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind;
|
||||
gdbarch_remote_breakpoint_from_pc_ftype *remote_breakpoint_from_pc;
|
||||
gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address;
|
||||
gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
|
||||
@ -403,6 +405,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->sw_breakpoint_from_kind = NULL;
|
||||
gdbarch->remote_breakpoint_from_pc = default_remote_breakpoint_from_pc;
|
||||
gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
|
||||
gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
|
||||
@ -583,6 +586,9 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
||||
fprintf_unfiltered (log, "\n\tinner_than");
|
||||
if (gdbarch->breakpoint_from_pc == 0)
|
||||
fprintf_unfiltered (log, "\n\tbreakpoint_from_pc");
|
||||
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 */
|
||||
/* Skip verify of remote_breakpoint_from_pc, invalid_p == 0 */
|
||||
/* Skip verify of adjust_breakpoint_address, has predicate. */
|
||||
/* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
|
||||
@ -792,6 +798,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: breakpoint_from_pc = <%s>\n",
|
||||
host_address_to_string (gdbarch->breakpoint_from_pc));
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: breakpoint_kind_from_pc = <%s>\n",
|
||||
host_address_to_string (gdbarch->breakpoint_kind_from_pc));
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: byte_order = %s\n",
|
||||
plongest (gdbarch->byte_order));
|
||||
@ -1398,6 +1407,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: static_transform_name = <%s>\n",
|
||||
host_address_to_string (gdbarch->static_transform_name));
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: sw_breakpoint_from_kind = <%s>\n",
|
||||
host_address_to_string (gdbarch->sw_breakpoint_from_kind));
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: syscalls_info = %s\n",
|
||||
host_address_to_string (gdbarch->syscalls_info));
|
||||
@ -2782,6 +2794,40 @@ set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
|
||||
gdbarch->breakpoint_from_pc = breakpoint_from_pc;
|
||||
}
|
||||
|
||||
int
|
||||
gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
gdb_assert (gdbarch != NULL);
|
||||
gdb_assert (gdbarch->breakpoint_kind_from_pc != NULL);
|
||||
if (gdbarch_debug >= 2)
|
||||
fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_kind_from_pc called\n");
|
||||
return gdbarch->breakpoint_kind_from_pc (gdbarch, pcptr);
|
||||
}
|
||||
|
||||
void
|
||||
set_gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch,
|
||||
gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
|
||||
{
|
||||
gdbarch->breakpoint_kind_from_pc = breakpoint_kind_from_pc;
|
||||
}
|
||||
|
||||
const gdb_byte *
|
||||
gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
gdb_assert (gdbarch != NULL);
|
||||
gdb_assert (gdbarch->sw_breakpoint_from_kind != NULL);
|
||||
if (gdbarch_debug >= 2)
|
||||
fprintf_unfiltered (gdb_stdlog, "gdbarch_sw_breakpoint_from_kind called\n");
|
||||
return gdbarch->sw_breakpoint_from_kind (gdbarch, kind, size);
|
||||
}
|
||||
|
||||
void
|
||||
set_gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch,
|
||||
gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
|
||||
{
|
||||
gdbarch->sw_breakpoint_from_kind = sw_breakpoint_from_kind;
|
||||
}
|
||||
|
||||
void
|
||||
gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *kindptr)
|
||||
{
|
||||
|
@ -550,6 +550,20 @@ typedef const gdb_byte * (gdbarch_breakpoint_from_pc_ftype) (struct gdbarch *gdb
|
||||
extern const gdb_byte * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
|
||||
extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc);
|
||||
|
||||
/* Return the breakpoint kind for this target based on *PCPTR. */
|
||||
|
||||
typedef int (gdbarch_breakpoint_kind_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr);
|
||||
extern int gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr);
|
||||
extern void set_gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc);
|
||||
|
||||
/* Return the software breakpoint from KIND. KIND can have target
|
||||
specific meaning like the Z0 kind parameter.
|
||||
SIZE is set to the software breakpoint's length in memory. */
|
||||
|
||||
typedef const gdb_byte * (gdbarch_sw_breakpoint_from_kind_ftype) (struct gdbarch *gdbarch, int kind, int *size);
|
||||
extern const gdb_byte * gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size);
|
||||
extern void set_gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind);
|
||||
|
||||
/* Return the adjusted address and kind to use for Z0/Z1 packets.
|
||||
KIND is usually the memory length of the breakpoint, but may have a
|
||||
different target-specific meaning. */
|
||||
|
@ -560,6 +560,15 @@ 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:
|
||||
|
||||
# Return the breakpoint kind for this target based on *PCPTR.
|
||||
m:int:breakpoint_kind_from_pc:CORE_ADDR *pcptr:pcptr::0:
|
||||
|
||||
# Return the software breakpoint from KIND. KIND can have target
|
||||
# specific meaning like the Z0 kind parameter.
|
||||
# SIZE is set to the software breakpoint's length in memory.
|
||||
m:const gdb_byte *:sw_breakpoint_from_kind:int kind, int *size:kind, size::NULL::0
|
||||
|
||||
# Return the adjusted address and kind to use for Z0/Z1 packets.
|
||||
# KIND is usually the memory length of the breakpoint, but may have a
|
||||
# different target-specific meaning.
|
||||
|
@ -719,8 +719,6 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
|
||||
paddress (gdbarch, bp_tgt->placed_address));
|
||||
replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
|
||||
|
||||
bp_tgt->placed_size = bp_tgt->shadow_len;
|
||||
|
||||
val = target_write_memory (addr + shadow_slotnum, bundle + shadow_slotnum,
|
||||
bp_tgt->shadow_len);
|
||||
|
||||
@ -783,8 +781,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
|
||||
slotnum = 2;
|
||||
}
|
||||
|
||||
gdb_assert (bp_tgt->placed_size == BUNDLE_LEN - shadow_slotnum);
|
||||
gdb_assert (bp_tgt->placed_size == bp_tgt->shadow_len);
|
||||
gdb_assert (bp_tgt->shadow_len == BUNDLE_LEN - shadow_slotnum);
|
||||
|
||||
instr_breakpoint = slotN_contents (bundle_mem, slotnum);
|
||||
if (instr_breakpoint != IA64_BREAKPOINT)
|
||||
@ -812,6 +809,15 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
|
||||
return val;
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
ia64_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
/* A place holder of gdbarch method breakpoint_kind_from_pc. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* As gdbarch_breakpoint_from_pc ranges have byte granularity and ia64
|
||||
instruction slots ranges are bit-granular (41 bits) we have to provide an
|
||||
extended range as described for ia64_memory_insert_breakpoint. We also take
|
||||
@ -4009,6 +4015,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
set_gdbarch_memory_remove_breakpoint (gdbarch,
|
||||
ia64_memory_remove_breakpoint);
|
||||
set_gdbarch_breakpoint_from_pc (gdbarch, ia64_breakpoint_from_pc);
|
||||
set_gdbarch_breakpoint_kind_from_pc (gdbarch, ia64_breakpoint_kind_from_pc);
|
||||
set_gdbarch_read_pc (gdbarch, ia64_read_pc);
|
||||
set_gdbarch_write_pc (gdbarch, ia64_write_pc);
|
||||
|
||||
|
@ -91,7 +91,7 @@ m32r_memory_insert_breakpoint (struct gdbarch *gdbarch,
|
||||
return val; /* return error */
|
||||
|
||||
memcpy (bp_tgt->shadow_contents, contents_cache, 4);
|
||||
bp_tgt->placed_size = bp_tgt->shadow_len = 4;
|
||||
bp_tgt->shadow_len = 4;
|
||||
|
||||
/* Determine appropriate breakpoint contents and size for this address. */
|
||||
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
|
||||
@ -165,6 +165,8 @@ m32r_memory_remove_breakpoint (struct gdbarch *gdbarch,
|
||||
return val;
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
m32r_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -174,6 +176,8 @@ m32r_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
m32r_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -44,10 +44,7 @@ default_memory_insert_breakpoint (struct gdbarch *gdbarch,
|
||||
int val;
|
||||
|
||||
/* Determine appropriate breakpoint contents and size for this address. */
|
||||
bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
|
||||
|
||||
bp_tgt->placed_address = addr;
|
||||
bp_tgt->placed_size = bplen;
|
||||
bp = gdbarch_sw_breakpoint_from_kind (gdbarch, bp_tgt->placed_size, &bplen);
|
||||
|
||||
/* Save the memory contents in the shadow_contents buffer and then
|
||||
write the breakpoint instruction. */
|
||||
@ -77,8 +74,12 @@ int
|
||||
default_memory_remove_breakpoint (struct gdbarch *gdbarch,
|
||||
struct bp_target_info *bp_tgt)
|
||||
{
|
||||
int bplen;
|
||||
|
||||
gdbarch_sw_breakpoint_from_kind (gdbarch, bp_tgt->placed_size, &bplen);
|
||||
|
||||
return target_write_raw_memory (bp_tgt->placed_address, bp_tgt->shadow_contents,
|
||||
bp_tgt->placed_size);
|
||||
bplen);
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +114,7 @@ memory_validate_breakpoint (struct gdbarch *gdbarch,
|
||||
address. */
|
||||
bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
|
||||
|
||||
if (bp == NULL || bp_tgt->placed_size != bplen)
|
||||
if (bp == NULL)
|
||||
return 0;
|
||||
|
||||
/* Make sure we see the memory breakpoints. */
|
||||
|
@ -7035,6 +7035,8 @@ gdb_print_insn_mips_n64 (bfd_vma memaddr, struct disassemble_info *info)
|
||||
return gdb_print_insn_mips (memaddr, info);
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
mips_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -7061,6 +7063,8 @@ mips_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
return MIPS_BP_KIND_MIPS32;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
mips_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -449,12 +449,16 @@ mt_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
return pc;
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
mt_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
mt_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -1694,6 +1694,8 @@ nios2_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
|
||||
return nios2_analyze_prologue (gdbarch, start_pc, start_pc, &cache, NULL);
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
nios2_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -1714,6 +1716,8 @@ nios2_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
return NIOS2_OPCODE_SIZE;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
nios2_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -1673,16 +1673,6 @@ record_full_insert_breakpoint (struct target_ops *ops,
|
||||
|
||||
in_target_beneath = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CORE_ADDR addr = bp_tgt->reqstd_address;
|
||||
int bplen;
|
||||
|
||||
gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
|
||||
|
||||
bp_tgt->placed_address = addr;
|
||||
bp_tgt->placed_size = bplen;
|
||||
}
|
||||
|
||||
/* Use the existing entries if found in order to avoid duplication
|
||||
in record_full_breakpoints. */
|
||||
|
16
gdb/remote.c
16
gdb/remote.c
@ -9710,8 +9710,6 @@ remote_insert_breakpoint (struct target_ops *ops,
|
||||
if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
|
||||
set_general_process ();
|
||||
|
||||
gdbarch_remote_breakpoint_from_pc (gdbarch, &addr, &bpsize);
|
||||
|
||||
rs = get_remote_state ();
|
||||
p = rs->buf;
|
||||
endbuf = rs->buf + get_remote_packet_size ();
|
||||
@ -9721,7 +9719,7 @@ remote_insert_breakpoint (struct target_ops *ops,
|
||||
*(p++) = ',';
|
||||
addr = (ULONGEST) remote_address_masked (addr);
|
||||
p += hexnumstr (p, addr);
|
||||
xsnprintf (p, endbuf - p, ",%d", bpsize);
|
||||
xsnprintf (p, endbuf - p, ",%d", bp_tgt->placed_size);
|
||||
|
||||
if (remote_supports_cond_breakpoints (ops))
|
||||
remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
|
||||
@ -9737,8 +9735,6 @@ remote_insert_breakpoint (struct target_ops *ops,
|
||||
case PACKET_ERROR:
|
||||
return -1;
|
||||
case PACKET_OK:
|
||||
bp_tgt->placed_address = addr;
|
||||
bp_tgt->placed_size = bpsize;
|
||||
return 0;
|
||||
case PACKET_UNKNOWN:
|
||||
break;
|
||||
@ -10015,12 +10011,6 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
|
||||
struct remote_state *rs;
|
||||
char *p, *endbuf;
|
||||
char *message;
|
||||
int bpsize;
|
||||
|
||||
/* The length field should be set to the size of a breakpoint
|
||||
instruction, even though we aren't inserting one ourselves. */
|
||||
|
||||
gdbarch_remote_breakpoint_from_pc (gdbarch, &addr, &bpsize);
|
||||
|
||||
if (packet_support (PACKET_Z1) == PACKET_DISABLE)
|
||||
return -1;
|
||||
@ -10040,7 +10030,7 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
|
||||
|
||||
addr = remote_address_masked (addr);
|
||||
p += hexnumstr (p, (ULONGEST) addr);
|
||||
xsnprintf (p, endbuf - p, ",%x", bpsize);
|
||||
xsnprintf (p, endbuf - p, ",%x", bp_tgt->placed_size);
|
||||
|
||||
if (remote_supports_cond_breakpoints (self))
|
||||
remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
|
||||
@ -10064,8 +10054,6 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
|
||||
case PACKET_UNKNOWN:
|
||||
return -1;
|
||||
case PACKET_OK:
|
||||
bp_tgt->placed_address = addr;
|
||||
bp_tgt->placed_size = bpsize;
|
||||
return 0;
|
||||
}
|
||||
internal_error (__FILE__, __LINE__,
|
||||
|
@ -306,6 +306,8 @@ score3_adjust_pc_and_fetch_inst (CORE_ADDR *pcptr, int *lenptr,
|
||||
return &inst;
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
score7_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -335,6 +337,8 @@ score7_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
score7_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
@ -366,6 +370,8 @@ 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
|
||||
score3_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -377,6 +383,8 @@ score3_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
score3_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -418,12 +418,16 @@ sh_sh4al_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
|
||||
return register_names[reg_nr];
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
sh_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
sh_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -318,12 +318,16 @@ tic6x_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
tic6x_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
tic6x_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -1168,12 +1168,16 @@ v850_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||
return RETURN_VALUE_REGISTER_CONVENTION;
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
v850_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
v850_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
@ -1959,6 +1959,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
|
||||
return sp + SP_ALIGNMENT;
|
||||
}
|
||||
|
||||
/* Implement the breakpoint_kind_from_pc gdbarch method. */
|
||||
|
||||
static int
|
||||
xtensa_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
{
|
||||
@ -1977,6 +1979,8 @@ xtensa_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
|
||||
#define DENSITY_BIG_BREAKPOINT { 0xd2, 0x0f }
|
||||
#define DENSITY_LITTLE_BREAKPOINT { 0x2d, 0xf0 }
|
||||
|
||||
/* Implement the sw_breakpoint_from_kind gdbarch method. */
|
||||
|
||||
static const gdb_byte *
|
||||
xtensa_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user