[Ltrace-devel] [PATCH v2 1/3] mipsel: Improve singlestepping over branch always

edgar.iglesias at gmail.com edgar.iglesias at gmail.com
Mon Oct 1 10:06:44 UTC 2012


From: "Edgar E. Iglesias" <edgar at axis.com>

When singlestepping over BEQ issuing a compare between
a single register (i.e a branch always), only follow the
branch path.

This catches the case for functions that end with loops
and avoids us putting breakpoints at the begining of the
next function (where there likely already is a bp).

Signed-off-by: Edgar E. Iglesias <edgar at axis.com>
---
 sysdeps/linux-gnu/mipsel/trace.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/sysdeps/linux-gnu/mipsel/trace.c b/sysdeps/linux-gnu/mipsel/trace.c
index a8a680a..8094fb7 100644
--- a/sysdeps/linux-gnu/mipsel/trace.c
+++ b/sysdeps/linux-gnu/mipsel/trace.c
@@ -201,8 +201,16 @@ int mips_next_pcs(struct Process *proc, uint32_t pc, uint32_t *newpc)
 			/* Upper four bits get never changed...  */
 			newpc[nr++] = rx + ((pc + 4) & ~0x0fffffff);
 			break;
+		case 4: /* BEQ  */
+			if (itype_rs(inst) == itype_rt(inst)) {
+				/* Compare the same reg for equality, always
+				 * follow the branch.  */
+				newpc[nr++] = pc + 4 +
+					mips32_relative_offset(inst);
+				break;
+			}
+			/* Fall through.  */
 		default:
-		case 4:
 		case 5:
 		case 6:
 		case 7:
-- 
1.7.8.6




More information about the Ltrace-devel mailing list