qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v5 19/24] tests/avocado: reverse_debugging.py add snapshot testin


From: Nicholas Piggin
Subject: [PATCH v5 19/24] tests/avocado: reverse_debugging.py add snapshot testing
Date: Tue, 19 Mar 2024 01:46:16 +1000

Make a manual snapshot halfway though initial building of the address
map in record mode.

This will cause the reverse-step and reverse-continue tests to load that
snapshot when beginning from later points in the trace, exercising the
post-initial snapshot saving and loading.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 tests/avocado/reverse_debugging.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tests/avocado/reverse_debugging.py 
b/tests/avocado/reverse_debugging.py
index c0cf580d5c..185f055cf9 100644
--- a/tests/avocado/reverse_debugging.py
+++ b/tests/avocado/reverse_debugging.py
@@ -59,7 +59,7 @@ def run_vm(self, record, shift, args, replay_path, 
image_path, port):
         vm.add_args('-icount', 'shift=%s,rr=%s,rrfile=%s,rrsnapshot=init' %
                     (shift, mode, replay_path),
                     '-net', 'none')
-        vm.add_args('-drive', 'file=%s,if=none' % image_path)
+        vm.add_args('-drive', 'file=%s,if=none,id=disk0' % image_path)
         if args:
             vm.add_args(*args)
         vm.launch()
@@ -133,6 +133,14 @@ def gdb_bstep(g):
     def vm_get_icount(vm):
         return vm.qmp('query-replay')['return']['icount']
 
+    @staticmethod
+    def vm_snapshot(vm):
+        return vm.qmp('snapshot-save',
+                      {'job-id': 'snapshot-job',
+                       'tag': 'manual',
+                       'vmstate': 'disk0',
+                       'devices': []})
+
     def reverse_debugging(self, shift=7, args=None):
         logger = logging.getLogger('replay')
 
@@ -171,6 +179,9 @@ def reverse_debugging(self, shift=7, args=None):
             pc = self.get_pc(g)
             logger.info('saving position %x' % pc)
             steps.append(pc)
+            if i == self.STEPS//2:
+                logger.info('saving VM snapshot at step %x...' % i)
+                self.vm_snapshot(vm)
             self.gdb_step(g)
             if self.first_step_workaround and i == 0 and 
self.vm_get_icount(vm) == 0:
                 logger.warn('failed to take first step, stepping again')
@@ -217,7 +228,9 @@ def reverse_debugging(self, shift=7, args=None):
             self.gdb_step(g)
             logger.info('found position %x' % addr)
 
-        # Try reverse stepping
+        # Try reverse stepping. The manual snapshot taken in the record
+        # phase should be used for reverse-stepping until the machine
+        # reverses to an icount older than the snapshot.
         logger.info('stepping backward')
         for addr in steps[::-1]:
             self.gdb_bstep(g)
@@ -242,6 +255,8 @@ def reverse_debugging(self, shift=7, args=None):
             self.check_pc(g, last_pc)
             logger.info('found position %x' % last_pc)
 
+            # This should load the last snapshot taken. Could that be verified
+            # with QMP?
             logger.info('stepping backward')
             self.gdb_bstep(g)
 
-- 
2.42.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]