Hi Pavel,

On Tue, Oct 6, 2020 at 9:41 AM Paolo Bonzini <[email protected]> wrote:
>
> From: Pavel Dovgalyuk <[email protected]>
>
> This patch adds support of the reverse continue operation for gdbstub.
> Reverse continue finds the last breakpoint that would happen in normal
> execution from the beginning to the current moment.
> Implementation of the reverse continue replays the execution twice:
> to find the breakpoints that were hit and to seek to the last breakpoint.
> Reverse continue loads the previous snapshot and tries to find the breakpoint
> since that moment. If there are no such breakpoints, it proceeds to
> the earlier snapshot, and so on. When no breakpoints or watchpoints were
> hit at all, execution stops at the beginning of the replay log.
>
> Signed-off-by: Pavel Dovgalyuk <[email protected]>
> Message-Id: <160174522930.12451.6994758004725016836.stgit@pasha-ThinkPad-X280>
> Signed-off-by: Paolo Bonzini <[email protected]>
> ---
>  exec.c                    |  1 +
>  gdbstub.c                 | 10 +++++-
>  include/sysemu/replay.h   |  8 +++++
>  replay/replay-debugging.c | 72 +++++++++++++++++++++++++++++++++++++++
>  softmmu/cpus.c            |  5 +++
>  stubs/replay.c            |  5 +++
>  6 files changed, 100 insertions(+), 1 deletion(-)
...
> +static void replay_continue_stop(void *opaque)
> +{
> +    Error *err = NULL;
> +    if (replay_last_breakpoint != -1LL) {
> +        replay_seek(replay_last_breakpoint, replay_stop_vm_debug, &err);
> +        if (err) {
> +            error_free(err);
> +            replay_continue_end();
> +        }
> +        return;
> +    }
> +    /*
> +     * No breakpoints since the last snapshot.
> +     * Find previous snapshot and try again.
> +     */
> +    if (replay_last_snapshot != 0) {
> +        replay_seek(replay_last_snapshot - 1, replay_continue_stop, &err);
> +        if (err) {
> +            error_free(err);
> +            replay_continue_end();
> +        }
> +        replay_last_snapshot = replay_get_current_icount();
> +        return;
> +    } else {
> +        /* Seek to the very first step */
> +        replay_seek(0, replay_stop_vm_debug, &err);
> +        if (err) {
> +            error_free(err);
> +            replay_continue_end();
> +        }
> +        return;
> +    }

Coverity (CID 1433220) reports this is dead code:

> +    replay_continue_end();
> +}
> +


Reply via email to