ARM singlestep bug

Paul Brook paul@codesourcery.com
Thu Jan 25 19:23:00 GMT 2007


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  <paul@codesourcery.com>

	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);



More information about the Gdb-patches mailing list