On Fri, Oct 30, 2026 at 2:56 PM Richard Henderson
<[email protected]> wrote:
> +    if (tcg_ctx->gen_tb->cflags & CF_NO_GOTO_JC) {
> +        tcg_gen_lookup_and_goto_ptr();
> +    } else {
> +        plugin_gen_disable_mem_helpers();
> +        gen_jc_probe(pc, cs_base, flags);
> +    }

This drops the CF_NO_GOTO_PTR check for migrated targets. Both the hit
path and the slow path in gen_jc_probe() end in goto_ptr, and
tcg_update_cflags() sets CF_NO_GOTO_PTR for gdb single-step without
CF_NO_GOTO_JC. cpu_exec_step_atomic() sets both, so only single-step is
exposed.

The result is that stepping over a branch doesn't stop if the
destination is already in the jump cache. With qemu-alpha -g, on a
200-iteration bsr/ret loop, one 's' packet on the bne ran the remaining
199 iterations. Patch 8 steps it correctly.

Honoring both flags fixes it, and the step trace then matches patch 8:

    if (tcg_ctx->gen_tb->cflags & (CF_NO_GOTO_JC | CF_NO_GOTO_PTR)) {

Second problem: a probe hit skips the log_cpu_exec() call in
helper_lookup_tb_ptr(), so -d exec and -d cpu lose every inline
dispatch. Same loop, counting Trace lines:

    -d exec            205 at patch 8, 6 at patch 14
    -d exec,nochain    602 at patch 8, 5 at patch 14

The second one hurts most, since nochain exists so that those logs show
every TB. Taking the logging case off the inline path restores both
counts:

    if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints) ||
                 qemu_loglevel_mask(CPU_LOG_TB_CPU | CPU_LOG_EXEC))) {
        cflags |= CF_NO_GOTO_JC;
    }

The monitor path already calls tcg_update_all_cflags() after changing
the log mask, so it stays correct. The comment there only mentions
CPU_LOG_TB_NOCHAIN and would want updating.

The commit message needs a pass too, and most of this is mine:

 - "What is left is one_insn_per_tb and -d nochain; see below." There's
   nothing below. one_insn_per_tb is fine as it is, and the logging case
   is the part that needed covering.
 - "the flags, cflags and cs_base ... are constants at translation
   time" is no longer true of cs_base with goto_jc3.
 - The last paragraph calls a backend opcode "a separate series", but
   it's patches 10-13.

Reply via email to