All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, wrampazz@redhat.com, pavel.dovgalyuk@ispras.ru,
	ehabkost@redhat.com, alex.bennee@linaro.org, mtosatti@redhat.com,
	armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com,
	crosa@redhat.com, pbonzini@redhat.com, philmd@redhat.com,
	zhiwei_liu@c-sky.com, rth@twiddle.net
Subject: [PATCH v6 12/14] replay: describe reverse debugging in docs/replay.txt
Date: Tue, 29 Sep 2020 14:02:14 +0300	[thread overview]
Message-ID: <160137733419.31007.3169574970691780173.stgit@pasha-ThinkPad-X280> (raw)
In-Reply-To: <160137726426.31007.12061315974029139983.stgit@pasha-ThinkPad-X280>

From: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>

This patch updates the documentation and describes usage of the reverse
debugging in QEMU+GDB.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

--

v4 changes:
 - added an example of the command line for reverse debugging of
   the diskless machine
---
 docs/replay.txt |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/docs/replay.txt b/docs/replay.txt
index 70c27edb36..39fe5e9740 100644
--- a/docs/replay.txt
+++ b/docs/replay.txt
@@ -265,6 +265,16 @@ of the original disk image, use overlay files linked to the original images.
 Therefore all new snapshots (including the starting one) will be saved in
 overlays and the original image remains unchanged.
 
+When you need to use snapshots with diskless virtual machine,
+it must be started with 'orphan' qcow2 image. This image will be used
+for storing VM snapshots. Here is the example of the command line for this:
+
+  qemu-system-i386 -icount shift=3,rr=replay,rrfile=record.bin,rrsnapshot=init \
+    -net none -drive file=empty.qcow2,if=none,id=rr
+
+empty.qcow2 drive does not connected to any virtual block device and used
+for VM snapshots only.
+
 Network devices
 ---------------
 
@@ -294,6 +304,42 @@ for recording and replaying must contain identical number of ports in record
 and replay modes, but their backends may differ.
 E.g., '-serial stdio' in record mode, and '-serial null' in replay mode.
 
+Reverse debugging
+-----------------
+
+Reverse debugging allows "executing" the program in reverse direction.
+GDB remote protocol supports "reverse step" and "reverse continue"
+commands. The first one steps single instruction backwards in time,
+and the second one finds the last breakpoint in the past.
+
+Recorded executions may be used to enable reverse debugging. QEMU can't
+execute the code in backwards direction, but can load a snapshot and
+replay forward to find the desired position or breakpoint.
+
+The following GDB commands are supported:
+ - reverse-stepi (or rsi) - step one instruction backwards
+ - reverse-continue (or rc) - find last breakpoint in the past
+
+Reverse step loads the nearest snapshot and replays the execution until
+the required instruction is met.
+
+Reverse continue may include several passes of examining the execution
+between the snapshots. Each of the passes include the following steps:
+ 1. loading the snapshot
+ 2. replaying to examine the breakpoints
+ 3. if breakpoint or watchpoint was met
+    - loading the snaphot again
+    - replaying to the required breakpoint
+ 4. else
+    - proceeding to the p.1 with the earlier snapshot
+
+Therefore usage of the reverse debugging requires at least one snapshot
+created in advance. This can be done by omitting 'snapshot' option
+for the block drives and adding 'rrsnapshot' for both record and replay
+command lines.
+See the "Snapshotting" section to learn more about running record/replay
+and creating the snapshot in these modes.
+
 Replay log format
 -----------------
 



  parent reply	other threads:[~2020-09-29 11:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 11:01 [PATCH v6 00/14] Reverse debugging Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 01/14] replay: don't record interrupt poll Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 02/14] replay: provide an accessor for rr filename Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 03/14] qcow2: introduce icount field for snapshots Pavel Dovgalyuk
2020-10-01 12:53   ` Alex Bennée
2020-09-29 11:01 ` [PATCH v6 04/14] migration: " Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 05/14] qapi: introduce replay.json for record/replay-related stuff Pavel Dovgalyuk
2020-10-01 11:00   ` Alex Bennée
2020-09-29 11:01 ` [PATCH v6 06/14] replay: introduce info hmp/qmp command Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 07/14] replay: introduce breakpoint at the specified step Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 08/14] replay: implement replay-seek command Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 09/14] replay: flush rr queue before loading the vmstate Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 10/14] gdbstub: add reverse step support in replay mode Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 11/14] gdbstub: add reverse continue " Pavel Dovgalyuk
2020-09-29 11:02 ` Pavel Dovgalyuk [this message]
2020-09-29 11:02 ` [PATCH v6 13/14] replay: create temporary snapshot at debugger connection Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 14/14] tests/acceptance: add reverse debugging test Pavel Dovgalyuk
2020-09-29 22:15   ` Willian Rampazzo
2020-09-29 15:51 ` [PATCH v6 00/14] Reverse debugging no-reply
2020-10-02 15:39 ` Paolo Bonzini
2020-10-02 16:01   ` Pavel Dovgalyuk
2020-10-02 16:25   ` Pavel Dovgalyuk
2020-10-03 17:19   ` Pavel Dovgalyuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160137733419.31007.3169574970691780173.stgit@pasha-ThinkPad-X280 \
    --to=pavel.dovgalyuk@ispras.ru \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    --cc=wrampazz@redhat.com \
    --cc=zhiwei_liu@c-sky.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.