Add debug tracing feature

It's disabled by default, use -DUNICORN_TRACER=on to enable it
This commit is contained in:
mio
2022-01-18 19:35:43 +01:00
parent abb958cac1
commit 28e791a37f
6 changed files with 149 additions and 1 deletions

View File

@ -55,9 +55,12 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
int tb_exit;
uint8_t *tb_ptr = itb->tc.ptr;
UC_TRACE_START(UC_TRACE_TB_EXEC);
tb_exec_lock(cpu->uc->tcg_ctx);
ret = tcg_qemu_tb_exec(env, tb_ptr);
tb_exec_unlock(cpu->uc->tcg_ctx);
UC_TRACE_END(UC_TRACE_TB_EXEC, "[uc] exec tb 0x%" PRIx64 ": ", itb->pc);
cpu->can_do_io = 1;
last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK);
tb_exit = ret & TB_EXIT_MASK;

View File

@ -1619,7 +1619,9 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
tcg_func_start(tcg_ctx);
tcg_ctx->cpu = env_cpu(env);
UC_TRACE_START(UC_TRACE_TB_TRANS);
gen_intermediate_code(cpu, tb, max_insns);
UC_TRACE_END(UC_TRACE_TB_TRANS, "[uc] translate tb 0x%" PRIx64 ": ", tb->pc);
tcg_ctx->cpu = NULL;
/* generate machine code */