This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

MIPS/Linux: Single-stepping running away


Hello,

 I've found two bugs in gdb that lead to single-stepping over branches 
failing under specific conditions -- the code tests register numbers 
instead of their values for a few variants of branches.  Here is an 
obvious fix.  It applies against the head.

2004-10-07  Maciej W. Rozycki  <macro@mips.com>

	* mips-tdep.c (mips32_next_pc): Check the register's contents,
	not its number for BLEZ/BLEZL and BGTZ/BGTZL.

 Please apply.

  Maciej

gdb-mips32_next_pc.patch
diff -up --recursive --new-file src.macro/gdb/mips-tdep.c src/gdb/mips-tdep.c
--- src.macro/gdb/mips-tdep.c	2004-09-28 14:04:51.000000000 +0000
+++ src/gdb/mips-tdep.c	2004-10-07 16:26:14.000000000 +0000
@@ -1273,7 +1273,7 @@ mips32_next_pc (CORE_ADDR pc)
 	    pc += 8;
 	  break;
 	case 6:		/* BLEZ, BLEZL */
-	  if (read_signed_register (itype_rs (inst) <= 0))
+	  if (read_signed_register (itype_rs (inst)) <= 0)
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;
@@ -1281,7 +1281,7 @@ mips32_next_pc (CORE_ADDR pc)
 	case 7:
 	default:
 	greater_branch:	/* BGTZ, BGTZL */
-	  if (read_signed_register (itype_rs (inst) > 0))
+	  if (read_signed_register (itype_rs (inst)) > 0)
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]