[3/3] PPC: Fix for the gdb single step problem on an rfi instruction

Message ID 1321029448-11010-4-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf Nov. 11, 2011, 4:37 p.m.
From: Sebastian Bauer <mail@sebastianbauer.info>

When using gdb to single step a ppc interrupt routine, the execution
flow passes the rfi instruction without actually returning from the

The patch fixes this by avoiding to update the nip when the debug
exception is raised and a previous POWERPC_EXCP_SYNC was set.

The latter is the case only, if code for rfi or a related instruction
was generated.

Signed-off-by: Sebastian Bauer <mail@sebastianbauer.info>
Signed-off-by: Alexander Graf <agraf@suse.de>
 target-ppc/translate.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 99e995c..66eae30 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -298,8 +298,10 @@  static inline void gen_debug_exception(DisasContext *ctx)
     TCGv_i32 t0;
-    if (ctx->exception != POWERPC_EXCP_BRANCH)
+    if ((ctx->exception != POWERPC_EXCP_BRANCH) &&
+        (ctx->exception != POWERPC_EXCP_SYNC)) {
         gen_update_nip(ctx, ctx->nip);
+    }
     t0 = tcg_const_i32(EXCP_DEBUG);