Hi Philippe, > num_insns is a 'size_t'.
You are right. I copied the `int` type from `DisasContextBase`, but it should really be `size_t`. I'll send an updated patch. Thanks, Matt On Fri, Jul 14, 2023 at 11:09 AM Philippe Mathieu-Daudé <phi...@linaro.org> wrote: > > Hi Matt, > > On 14/7/23 06:18, Matt Borgerson wrote: > > Translation logic may partially decode an instruction, then abort and > > remove the instruction from the TB. This can happen for example when an > > instruction spans two pages. In this case, plugins may get an incorrect > > result when calling qemu_plugin_tb_n_insns to query for the number of > > instructions in the TB. This patch updates plugin_gen_tb_end to set the > > final instruction count. > > > > Signed-off-by: Matt Borgerson <cont...@mborgerson.com> > > --- > > accel/tcg/plugin-gen.c | 5 ++++- > > accel/tcg/translator.c | 2 +- > > include/exec/plugin-gen.h | 4 ++-- > > 3 files changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/include/exec/plugin-gen.h b/include/exec/plugin-gen.h > > index 52828781bc..4feaa47b08 100644 > > --- a/include/exec/plugin-gen.h > > +++ b/include/exec/plugin-gen.h > > @@ -20,7 +20,7 @@ struct DisasContextBase; > > > > bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db, > > bool supress); > > -void plugin_gen_tb_end(CPUState *cpu); > > +void plugin_gen_tb_end(CPUState *cpu, int num_insns); > > num_insns is a 'size_t'.