Skip to contentSkip to conversation

Fix PPC branch insn debugging

PATCH New Blue Swirl 1 participant 1 message Feb 13, 2009

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

PATCH 1/1 Fix PPC branch insn debugging

Hi,

With this patch applied, single stepping works even from the first instruction (bl 0xfff01704) in 0xfffffffc. For some reason, the first instruction doesn't get disassembled.

IN:

OP:
movi_i32 lr,$0x0
movi_i32 nip,$0xfff01704
movi_i32 tmp0,$0x10002
movi_i64 tmp1,$raise_exception
call tmp1,$0x0,$0,tmp0
exit_tb $0x0

IN:
0xfff01704: li r0,0

OP:
movi_i32 r0,$0x0
movi_i32 nip,$0xfff01708
movi_i32 nip,$0xfff01708
movi_i32 tmp0,$0x10002
movi_i64 tmp1,$raise_exception
call tmp1,$0x0,$0,tmp0
exit_tb $0x0

target-ppc/translate.c +3 -1
Index: qemu/target-ppc/translate.c
===================================================================
@@ -278,7 +278,9 @@
 static always_inline void gen_debug_exception (DisasContext *ctx)
 {
     TCGv_i32 t0;
-    gen_update_nip(ctx, ctx->nip);
+
+    if (ctx->exception != POWERPC_EXCP_BRANCH)
+        gen_update_nip(ctx, ctx->nip);
     t0 = tcg_const_i32(EXCP_DEBUG);
     gen_helper_raise_exception(t0);
     tcg_temp_free_i32(t0);