From nobody Sun Nov 16 12:44:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ispras.ru ARC-Seal: i=1; a=rsa-sha256; t=1600063790; cv=none; d=zohomail.com; s=zohoarc; b=Blc1P4tRW2pVObq2TJoRgUb9lD3Ol6jQy/WP006akRLXSw2X7YsSETfJkGzz/888tt7HJL1/88IcyoVF+87SQ5PQP43eLvKwTFNiKuaP3MYRfM+MkwMoPsNi8E5saP8KQJfFfa2vhbHLwUQ01Sp4NzMTQhEx87rLfwaJodywn3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600063790; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WTShHLZwXH5uZVE4wPfWgfhJTBywJ60JlDjGERrHN3c=; b=WpIXxty4V3XrGmNp5frJxCDbJ/Hsy/mB3WPQg8MDMsWmzny4/1SRxsOGLr0eNazn1mNYI5Erywpk+j9QwGBi+0HRkN04MA7Ws89ifubAt/c+Ntp+Cs8hgHDGUkg9DVqNrzDScLLrSpjlmqothIWl/EmUMqyTtiMutoFq2MHn4i8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16000637907711003.5565193654662; Sun, 13 Sep 2020 23:09:50 -0700 (PDT) Received: from localhost ([::1]:36420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHhgT-0000Av-Jb for importer@patchew.org; Mon, 14 Sep 2020 02:09:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHheO-0004MY-0W for qemu-devel@nongnu.org; Mon, 14 Sep 2020 02:07:40 -0400 Received: from mail.ispras.ru ([83.149.199.84]:44998) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHheL-0002RE-Uh for qemu-devel@nongnu.org; Mon, 14 Sep 2020 02:07:39 -0400 Received: from [127.0.1.1] (unknown [62.118.151.149]) by mail.ispras.ru (Postfix) with ESMTPSA id EFB4940D3BFF; Mon, 14 Sep 2020 06:07:35 +0000 (UTC) Subject: [PATCH v4 12/15] replay: describe reverse debugging in docs/replay.txt From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Mon, 14 Sep 2020 09:07:35 +0300 Message-ID: <160006365557.31457.13435872247215044498.stgit@pasha-ThinkPad-X280> In-Reply-To: <160006358590.31457.16757371597343007847.stgit@pasha-ThinkPad-X280> References: <160006358590.31457.16757371597343007847.stgit@pasha-ThinkPad-X280> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=83.149.199.84; envelope-from=pavel.dovgalyuk@ispras.ru; helo=mail.ispras.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/14 02:06:27 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch updates the documentation and describes usage of the reverse debugging in QEMU+GDB. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Alex Benn=C3=A9e -- 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 t= o the original images. Therefore all new snapshots (including the starting one) will be saved in overlays and the original image remains unchanged. =20 +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=3D3,rr=3Dreplay,rrfile=3Drecord.bin,rrsna= pshot=3Dinit \ + -net none -drive file=3Dempty.qcow2,if=3Dnone,id=3Drr + +empty.qcow2 drive does not connected to any virtual block device and used +for VM snapshots only. + Network devices --------------- =20 @@ -294,6 +304,42 @@ for recording and replaying must contain identical num= ber 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. =20 +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 ----------------- =20