ARM singlestep bug

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ARM singlestep bug

Paul Brook
The patch below fixes a bug in arm_get_next_pc. The test for the BX
instruction was incorrectly including the first bit of the condition code.
Bit 28 is clear on unconditonal BX instructions, so it works by chance most
of the time.

Ok?

Paul

2007-01-25  Paul Brook  <[hidden email]>

        gdb/
        * arm-tdep.c (arm_get_next_pc): Fix bitfield off-by-one error.

Index: gdb/arm-tdep.c
===================================================================
--- gdb/arm-tdep.c (revision 158575)
+++ gdb/arm-tdep.c (working copy)
@@ -1693,8 +1693,8 @@ arm_get_next_pc (CORE_ADDR pc)
       error (_("Invalid update to pc in instruction"));
 
     /* BX <reg>, BLX <reg> */
-    if (bits (this_instr, 4, 28) == 0x12fff1
- || bits (this_instr, 4, 28) == 0x12fff3)
+    if (bits (this_instr, 4, 27) == 0x12fff1
+ || bits (this_instr, 4, 27) == 0x12fff3)
       {
  rn = bits (this_instr, 0, 3);
  result = (rn == 15) ? pc_val + 8 : read_register (rn);
Reply | Threaded
Open this post in threaded view
|

Re: ARM singlestep bug

Daniel Jacobowitz-2
On Thu, Jan 25, 2007 at 07:23:39PM +0000, Paul Brook wrote:
> The patch below fixes a bug in arm_get_next_pc. The test for the BX
> instruction was incorrectly including the first bit of the condition code.
> Bit 28 is clear on unconditonal BX instructions, so it works by chance most
> of the time.
>
> Ok?

Oooops.  OK, thanks.

--
Daniel Jacobowitz
CodeSourcery