diff mbox

target/tricore: Fix QEMU crashing when using -singlestep

Message ID 20180430204640.1713-1-kbastian@mail.uni-paderborn.de (mailing list archive)
State New, archived
Headers show

Commit Message

Bastian Koppelmann April 30, 2018, 8:46 p.m. UTC
when -singlestep is enabled we will actually return a tb->size of 0,
even though we emit one instruction. This is because we do the update to ctx.pc
after exiting the translation loop on the singlestep path. Therefore we
substract pc_start from ctx.pc, aka pc_start.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target/tricore/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.11.0
diff mbox

Patch

diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index aef0d9cf06..be2579d189 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -8843,12 +8843,12 @@  void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
         ctx.opcode = cpu_ldl_code(env, ctx.pc);
         decode_opc(env, &ctx, 0);

+        ctx.pc = ctx.next_pc;
         if (num_insns >= max_insns || tcg_op_buf_full()) {
             gen_save_pc(ctx.next_pc);
             tcg_gen_exit_tb(0);
             break;
         }
-        ctx.pc = ctx.next_pc;
     }

     gen_tb_end(tb, num_insns);