aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-06-15 22:37:35 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-06-15 22:37:35 +0000
commit0b1b3e423ad28731135cdd275522bdf3d2d17570 (patch)
tree66c3aad944589e0365a5929e7820bfe050a33e82 /gdb/arm-tdep.c
parent9c9acae0c28d2b85588c305ed58aeef034e69e86 (diff)
downloadgdb-0b1b3e423ad28731135cdd275522bdf3d2d17570.zip
gdb-0b1b3e423ad28731135cdd275522bdf3d2d17570.tar.gz
gdb-0b1b3e423ad28731135cdd275522bdf3d2d17570.tar.bz2
* gdbarch.sh (software_single_step): Replace REGCACHE argument by
FRAME argument. * gdbarch.c, gdbarch.h: Regenerate. * infrun.c (resume): Pass current frame to SOFTWARE_SINGLE_STEP. * alpha-tdep.c (alpha_next_pc): Add FRAME argument. Retrieve registers from FRAME instead of using read_register. (alpha_software_single_step): Replace REGCACHE by FRAME. Pass FRAME to alpha_next_pc. Use get_frame_pc instead of read_pc. * alpha-tdep.h (alpha_software_single_step): Replace REGCACHE argument by FRAME. * arm-tdep.c (shifted_reg_val): Add FRAME argument. Read registers from FRAME instead of using read_register. (thumb_get_next_pc): Likewise. (arm_get_next_pc): Likewise. (arm_software_single_step): Replace REGCACHE by FRAME. Pass FRAME to arm_get_next_pc. Use get_frame_pc instead of read_register. * arm-tdep.h (arm_software_single_step): Replace REGCACHE argument by FRAME. * cris-tdep.c (find_step_target): Add FRAME argument. Read registers from FRAME instead of using read_register. (cris_software_single_step): Replace REGCACHE by FRAME. Pass FRAME to find_step_target. * mips-tdep.c (mips32_next_pc): Add FRAME argument. Read registers from FRAME instead of using read_register / read_signed_register. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (mips_next_pc): Likewise. (mips_software_single_step): Replace REGCACHE by FRAME. Pass FRAME to mips_next_pc. Use get_frame_pc instead of read_pc. * mips-tdep.h (mips_software_single_step): Replace REGCACHE argument by FRAME. * rs6000-tdep.c (branch_dest): Add FRAME argument. Use it instead of current frame. Read registers from FRAME. (deal_with_atomic_sequence): Add FRAME argument. Pass it to branch_dest. Use get_frame_pc instead of read_pc. (rs6000_software_single_step): Likewise. (bl_to_blrl_insn_p): Do not call branch_dest. * rs6000-tdep.h (rs6000_software_single_step): Replace REGCACHE argument by FRAME. * sparc64-linux-tdep.c (sparc64_linux_step_trap): Add FRAME argument. Read registers from FRAME instead of current regcache. * sparc-linux-tdep.c (sparc32_linux_step_trap): Likewise. * sparcnbsd-tdep.c (sparcnbsd_step_trap): Likewise. * sparc-tdep.c (sparc_address_from_register): Remove. (sparc_analyze_control_transfer): Pass FRAME argument instead of GDBARCH. Pass FRAME to step_trap callback. (sparc_step_trap): Add FRAME argument. (space_software_single_step): Replace REGCACHE by FRAME. Pass FRAME to sparc_analyze_control_transfer. Read registers from FRAME instead of calling sparc_address_from_register. * sparc-tdep.h (struct gdbarch_tdep): Add FRAME argument to step_trap callback. (sparc_address_from_register): Remove prototype. (sparc_software_single_step): Replace REGCACHE argument by FRAME. (sparcnbsd_step_trap): Add FRAME argument. * spu-tdep.c (spu_software_single_step): Replace REGCACHE argument by FRAME. Read registers from FRAME instead of REGCACHE.
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r--gdb/arm-tdep.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 9259ac8..fc7c6bd 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1547,8 +1547,8 @@ condition_true (unsigned long cond, unsigned long status_reg)
#define ARM_PC_32 1
static unsigned long
-shifted_reg_val (unsigned long inst, int carry, unsigned long pc_val,
- unsigned long status_reg)
+shifted_reg_val (struct frame_info *frame, unsigned long inst, int carry,
+ unsigned long pc_val, unsigned long status_reg)
{
unsigned long res, shift;
int rm = bits (inst, 0, 3);
@@ -1557,7 +1557,8 @@ shifted_reg_val (unsigned long inst, int carry, unsigned long pc_val,
if (bit (inst, 4))
{
int rs = bits (inst, 8, 11);
- shift = (rs == 15 ? pc_val + 8 : read_register (rs)) & 0xFF;
+ shift = (rs == 15 ? pc_val + 8
+ : get_frame_register_unsigned (frame, rs)) & 0xFF;
}
else
shift = bits (inst, 7, 11);
@@ -1565,7 +1566,7 @@ shifted_reg_val (unsigned long inst, int carry, unsigned long pc_val,
res = (rm == 15
? ((pc_val | (ARM_PC_32 ? 0 : status_reg))
+ (bit (inst, 4) ? 12 : 8))
- : read_register (rm));
+ : get_frame_register_unsigned (frame, rm));
switch (shifttype)
{
@@ -1608,7 +1609,7 @@ bitcount (unsigned long val)
}
static CORE_ADDR
-thumb_get_next_pc (CORE_ADDR pc)
+thumb_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
{
unsigned long pc_val = ((unsigned long) pc) + 4; /* PC after prefetch */
unsigned short inst1 = read_memory_unsigned_integer (pc, 2);
@@ -1622,7 +1623,7 @@ thumb_get_next_pc (CORE_ADDR pc)
/* Fetch the saved PC from the stack. It's stored above
all of the other registers. */
offset = bitcount (bits (inst1, 0, 7)) * DEPRECATED_REGISTER_SIZE;
- sp = read_register (ARM_SP_REGNUM);
+ sp = get_frame_register_unsigned (frame, ARM_SP_REGNUM);
nextpc = (CORE_ADDR) read_memory_unsigned_integer (sp + offset, 4);
nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc);
if (nextpc == pc)
@@ -1630,7 +1631,7 @@ thumb_get_next_pc (CORE_ADDR pc)
}
else if ((inst1 & 0xf000) == 0xd000) /* conditional branch */
{
- unsigned long status = read_register (ARM_PS_REGNUM);
+ unsigned long status = get_frame_register_unsigned (frame, ARM_PS_REGNUM);
unsigned long cond = bits (inst1, 8, 11);
if (cond != 0x0f && condition_true (cond, status)) /* 0x0f = SWI */
nextpc = pc_val + (sbits (inst1, 0, 7) << 1);
@@ -1653,7 +1654,7 @@ thumb_get_next_pc (CORE_ADDR pc)
if (bits (inst1, 3, 6) == 0x0f)
nextpc = pc_val;
else
- nextpc = read_register (bits (inst1, 3, 6));
+ nextpc = get_frame_register_unsigned (frame, bits (inst1, 3, 6));
nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc);
if (nextpc == pc)
@@ -1664,7 +1665,7 @@ thumb_get_next_pc (CORE_ADDR pc)
}
static CORE_ADDR
-arm_get_next_pc (CORE_ADDR pc)
+arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
{
unsigned long pc_val;
unsigned long this_instr;
@@ -1672,11 +1673,11 @@ arm_get_next_pc (CORE_ADDR pc)
CORE_ADDR nextpc;
if (arm_pc_is_thumb (pc))
- return thumb_get_next_pc (pc);
+ return thumb_get_next_pc (frame, pc);
pc_val = (unsigned long) pc;
this_instr = read_memory_unsigned_integer (pc, 4);
- status = read_register (ARM_PS_REGNUM);
+ status = get_frame_register_unsigned (frame, ARM_PS_REGNUM);
nextpc = (CORE_ADDR) (pc_val + 4); /* Default case */
if (condition_true (bits (this_instr, 28, 31), status))
@@ -1704,7 +1705,8 @@ arm_get_next_pc (CORE_ADDR pc)
|| bits (this_instr, 4, 27) == 0x12fff3)
{
rn = bits (this_instr, 0, 3);
- result = (rn == 15) ? pc_val + 8 : read_register (rn);
+ result = (rn == 15) ? pc_val + 8
+ : get_frame_register_unsigned (frame, rn);
nextpc = (CORE_ADDR) gdbarch_addr_bits_remove
(current_gdbarch, result);
@@ -1717,7 +1719,8 @@ arm_get_next_pc (CORE_ADDR pc)
/* Multiply into PC */
c = (status & FLAG_C) ? 1 : 0;
rn = bits (this_instr, 16, 19);
- operand1 = (rn == 15) ? pc_val + 8 : read_register (rn);
+ operand1 = (rn == 15) ? pc_val + 8
+ : get_frame_register_unsigned (frame, rn);
if (bit (this_instr, 25))
{
@@ -1727,7 +1730,7 @@ arm_get_next_pc (CORE_ADDR pc)
& 0xffffffff;
}
else /* operand 2 is a shifted register */
- operand2 = shifted_reg_val (this_instr, c, pc_val, status);
+ operand2 = shifted_reg_val (frame, this_instr, c, pc_val, status);
switch (bits (this_instr, 21, 24))
{
@@ -1813,14 +1816,15 @@ arm_get_next_pc (CORE_ADDR pc)
/* byte write to PC */
rn = bits (this_instr, 16, 19);
- base = (rn == 15) ? pc_val + 8 : read_register (rn);
+ base = (rn == 15) ? pc_val + 8
+ : get_frame_register_unsigned (frame, rn);
if (bit (this_instr, 24))
{
/* pre-indexed */
int c = (status & FLAG_C) ? 1 : 0;
unsigned long offset =
(bit (this_instr, 25)
- ? shifted_reg_val (this_instr, c, pc_val, status)
+ ? shifted_reg_val (frame, this_instr, c, pc_val, status)
: bits (this_instr, 0, 11));
if (bit (this_instr, 23))
@@ -1862,7 +1866,8 @@ arm_get_next_pc (CORE_ADDR pc)
{
unsigned long rn_val =
- read_register (bits (this_instr, 16, 19));
+ get_frame_register_unsigned (frame,
+ bits (this_instr, 16, 19));
nextpc =
(CORE_ADDR) read_memory_integer ((CORE_ADDR) (rn_val
+ offset),
@@ -1912,13 +1917,13 @@ arm_get_next_pc (CORE_ADDR pc)
and breakpoint it. */
int
-arm_software_single_step (struct regcache *regcache)
+arm_software_single_step (struct frame_info *frame)
{
/* NOTE: This may insert the wrong breakpoint instruction when
single-stepping over a mode-changing instruction, if the
CPSR heuristics are used. */
- CORE_ADDR next_pc = arm_get_next_pc (read_register (ARM_PC_REGNUM));
+ CORE_ADDR next_pc = arm_get_next_pc (frame, get_frame_pc (frame));
insert_single_step_breakpoint (next_pc);
return 1;