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

edgar.iglesias at gmail.com edgar.iglesias at gmail.com
Fri Sep 28 11:14:19 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 |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/sysdeps/linux-gnu/mipsel/trace.c b/sysdeps/linux-gnu/mipsel/trace.c
index a8a680a..bbbac94 100644
--- a/sysdeps/linux-gnu/mipsel/trace.c
+++ b/sysdeps/linux-gnu/mipsel/trace.c
@@ -202,7 +202,14 @@ int mips_next_pcs(struct Process *proc, uint32_t pc, uint32_t *newpc)
 			newpc[nr++] = rx + ((pc + 4) & ~0x0fffffff);
 			break;
 		default:
-		case 4:
+		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;
+			}
 		case 5:
 		case 6:
 		case 7:
-- 
1.7.8.6




More information about the Ltrace-devel mailing list