Il mer 19 nov 2025, 06:44 Philippe Mathieu-Daudé <[email protected]> ha
scritto:

> On 18/11/25 17:25, Paolo Bonzini wrote:
> > The replay subsystem does not have any way to see what's going on and
> > how the replay events interleave with other things happening in QEMU.
> >
> > Add trace events to improve debuggability; to avoid having too many
> > events reimplement all functions in terms of (non-traced)
> > replay_getc and replay_putc and add a single trace event for each
> > datum that is extracted or written.
> >
> > Signed-off-by: Paolo Bonzini <[email protected]>
> > ---
> >   meson.build              |  1 +
> >   replay/trace.h           |  1 +
> >   replay/replay-internal.c | 70 ++++++++++++++++++++++++++++++----------
> >   replay/trace-events      | 12 +++++++
> >   4 files changed, 67 insertions(+), 17 deletions(-)
> >   create mode 100644 replay/trace.h
> >   create mode 100644 replay/trace-events
>
>
> >   void replay_put_dword(uint32_t dword)
> >   {
> > -    replay_put_word(dword >> 16);
> > -    replay_put_word(dword);
> > +    int i;
> > +
> > +    trace_replay_put_dword(dword);
> > +    for (i = 24; i >= 0; i -= 8) {
>
> Matter of taste, this looks more natural to me:
>
>         for (i = 32; i > 0; i -= 8) {
>

But ">> (i - 8)" is uglier... Or you have to put i -= 8 in the loop body.

Paolo


> > +        replay_putc(dword >> i);
> > +    }
> >   }
> >
> >   void replay_put_qword(int64_t qword)
> >   {
> > -    replay_put_dword(qword >> 32);
> > -    replay_put_dword(qword);
> > +    int i;
> > +
> > +    trace_replay_put_qword(qword);
> > +    for (i = 56; i >= 0; i -= 8) {
>
> Ditto, etc.
>
> > +        replay_putc(qword >> i);
> > +    }
> >   }
>
> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
>
> Also, still taste, I'd have used trace_replay_{put,get}{8,16,32,64} ;)
>
>

Reply via email to