aboutsummaryrefslogtreecommitdiff
path: root/gdb/moxie-tdep.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-11-08 14:28:32 +0000
committerYao Qi <yao.qi@linaro.org>2016-11-08 14:28:32 +0000
commit93f9a11fbdb8f09428b17180d51a09a1bda39a52 (patch)
treed93c7ec1e9c42f2047151091fcb61333aa64c762 /gdb/moxie-tdep.c
parent0bc5d801ec836cd4b7d1ab7d05658e7a1d05df22 (diff)
gdbarch software_single_step returns VEC (CORE_ADDR) *
This patch changes gdbarch method software_single_step to return a vector of addresses on which GDB should insert breakpoints, and don't insert breakpoints. Instead, the caller of gdbarch_software_single_step inserts breakpoints if the returned vector is not NULL. gdb: 2016-11-08 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_software_single_step): Return VEC (CORE_ADDR) *. Return NULL instead of 0. Don't call insert_single_step_breakpoint. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise. (alpha_software_single_step): Likewise. * alpha-tdep.h (alpha_software_single_step): Update declaration. * arm-linux-tdep.c (arm_linux_software_single_step): Return VEC (CORE_ADDR) *. Return NULL instead of 0. * arm-tdep.c (arm_software_single_step): Return NULL instead of 0. * arm-tdep.h (arm_software_single_step): Update declaration. * breakpoint.c (insert_single_step_breakpoints): New function. * breakpoint.h (insert_single_step_breakpoints): Declare. * cris-tdep.c (cris_software_single_step): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * gdbarch.sh (software_single_step): Change it to return VEC (CORE_ADDR) *. * gdbarch.c, gdbarch.h: Regenerated. * infrun.c (maybe_software_singlestep): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. (micromips_deal_with_atomic_sequence): Likewise. (deal_with_atomic_sequence): Likewise. (mips_software_single_step): Likewise. * mips-tdep.h (mips_software_single_step): Update declaration. * moxie-tdep.c (moxie_software_single_step): Likewise. * nios2-tdep.c (nios2_software_single_step): Likewise. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Update declaration. * record-full.c (record_full_resume): Adjust. (record_full_wait_1): Likewise. * rs6000-aix-tdep.c (rs6000_software_single_step): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * s390-linux-tdep.c (s390_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * spu-tdep.c (spu_software_single_step): Likewise. * tic6x-tdep.c (tic6x_software_single_step): Likewise.
Diffstat (limited to 'gdb/moxie-tdep.c')
-rw-r--r--gdb/moxie-tdep.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index aadb270185..b3419459c1 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -299,11 +299,10 @@ moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
/* Insert a single step breakpoint. */
-static int
+static VEC (CORE_ADDR) *
moxie_software_single_step (struct frame_info *frame)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- struct address_space *aspace = get_frame_address_space (frame);
CORE_ADDR addr;
gdb_byte buf[4];
uint16_t inst;
@@ -311,6 +310,7 @@ moxie_software_single_step (struct frame_info *frame)
ULONGEST fp;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct regcache *regcache = get_current_regcache ();
+ VEC (CORE_ADDR) *next_pcs = NULL;
addr = get_frame_pc (frame);
@@ -338,8 +338,9 @@ moxie_software_single_step (struct frame_info *frame)
case 0x09: /* bleu */
/* Insert breaks on both branches, because we can't currently tell
which way things will go. */
- insert_single_step_breakpoint (gdbarch, aspace, addr + 2);
- insert_single_step_breakpoint (gdbarch, aspace, addr + 2 + INST2OFFSET(inst));
+ VEC_safe_push (CORE_ADDR, next_pcs, addr + 2);
+ VEC_safe_push (CORE_ADDR, next_pcs,
+ addr + 2 + INST2OFFSET(inst));
break;
default:
{
@@ -351,7 +352,7 @@ moxie_software_single_step (struct frame_info *frame)
else
{
/* This is a Form 2 instruction. They are all 16 bits. */
- insert_single_step_breakpoint (gdbarch, aspace, addr + 2);
+ VEC_safe_push (CORE_ADDR, next_pcs, addr + 2);
}
}
else
@@ -398,7 +399,7 @@ moxie_software_single_step (struct frame_info *frame)
case 0x32: /* udiv.l */
case 0x33: /* mod.l */
case 0x34: /* umod.l */
- insert_single_step_breakpoint (gdbarch, aspace, addr + 2);
+ VEC_safe_push (CORE_ADDR, next_pcs, addr + 2);
break;
/* 32-bit instructions. */
@@ -408,7 +409,7 @@ moxie_software_single_step (struct frame_info *frame)
case 0x37: /* sto.b */
case 0x38: /* ldo.s */
case 0x39: /* sto.s */
- insert_single_step_breakpoint (gdbarch, aspace, addr + 4);
+ VEC_safe_push (CORE_ADDR, next_pcs, addr + 4);
break;
/* 48-bit instructions. */
@@ -421,32 +422,27 @@ moxie_software_single_step (struct frame_info *frame)
case 0x20: /* ldi.s (immediate) */
case 0x22: /* lda.s */
case 0x24: /* sta.s */
- insert_single_step_breakpoint (gdbarch, aspace, addr + 6);
+ VEC_safe_push (CORE_ADDR, next_pcs, addr + 6);
break;
/* Control flow instructions. */
case 0x03: /* jsra */
case 0x1a: /* jmpa */
- insert_single_step_breakpoint (gdbarch, aspace,
- moxie_process_readu (addr + 2,
- buf, 4,
- byte_order));
+ VEC_safe_push (CORE_ADDR, next_pcs,
+ moxie_process_readu (addr + 2, buf, 4, byte_order));
break;
case 0x04: /* ret */
regcache_cooked_read_unsigned (regcache, MOXIE_FP_REGNUM, &fp);
- insert_single_step_breakpoint (gdbarch, aspace,
- moxie_process_readu (fp + 4,
- buf, 4,
- byte_order));
+ VEC_safe_push (CORE_ADDR, next_pcs,
+ moxie_process_readu (fp + 4, buf, 4, byte_order));
break;
case 0x19: /* jsr */
case 0x25: /* jmp */
regcache_raw_read (regcache,
(inst >> 4) & 0xf, (gdb_byte *) & tmpu32);
- insert_single_step_breakpoint (gdbarch, aspace,
- tmpu32);
+ VEC_safe_push (CORE_ADDR, next_pcs, tmpu32);
break;
case 0x30: /* swi */
@@ -456,7 +452,7 @@ moxie_software_single_step (struct frame_info *frame)
}
}
- return 1;
+ return next_pcs;
}
/* Implement the "read_pc" gdbarch method. */