[pypy-commit] pypy reverse-debugger: Write down how it is supposed to work (not fully implemented, must be fixed)

arigo pypy.commits at gmail.com
Sun Jul 3 12:41:07 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: reverse-debugger
Changeset: r85526:a0ec1eb89799
Date: 2016-07-03 18:42 +0200
http://bitbucket.org/pypy/pypy/changeset/a0ec1eb89799/

Log:	Write down how it is supposed to work (not fully implemented, must
	be fixed)

diff --git a/rpython/translator/revdb/gencsupp.py b/rpython/translator/revdb/gencsupp.py
--- a/rpython/translator/revdb/gencsupp.py
+++ b/rpython/translator/revdb/gencsupp.py
@@ -4,6 +4,44 @@
 from rpython.translator.c.support import cdecl
 from rpython.rlib import exports, revdb
 
+#
+# How It Works: we arrange things so that when replaying, all variables
+# have the "same" content as they had during recording.  More precisely,
+# we divide all variables according to their type in two categories:
+#
+#  * "moving things", whose value during recording is bitwise different
+#    from their value during replaying;
+#
+#  * "fixed things", whose values are bitwise identical.
+#
+# Moving things are:
+#
+#  * GC pointers.  During replaying they point to locally-allocated
+#    memory that is an object with the "same" content as during
+#    recording;
+#
+#  * pointers to RPython functions;
+#
+#  * pointers to structures with the "static_immutable" hint, like
+#    vtables.
+#
+# Fixed things are the rest:
+#
+#  * integers, floats;
+#
+#  * most raw pointers, which during replaying will thus point to
+#    nonsense.  (This pointer is not used during replaying to
+#    read/write memory: any write is ignored, and any read has its
+#    result recorded in the log.)
+#
+# Note an issue with prebuilt raw pointers to fixed things (i.e. all
+# constants in the C sources that appear either inside the code or
+# inside "static_immutable" or prebuilt GC structures).  During
+# replaying, they must correspond to bitwise the same value as during
+# recording, and not to the local-process address of the raw
+# structure, which is typically different (and should never be used).
+#
+
 
 def extra_files():
     srcdir = py.path.local(__file__).join('..', 'src-revdb')
diff --git a/rpython/translator/revdb/test/test_raw.py b/rpython/translator/revdb/test/test_raw.py
--- a/rpython/translator/revdb/test/test_raw.py
+++ b/rpython/translator/revdb/test/test_raw.py
@@ -34,6 +34,15 @@
         recbar.q = foo
         recbar.super.p = foo
 
+        IBAR = lltype.Struct('IBAR', ('p', lltype.Ptr(FOO)),
+                             hints={'static_immutable': True})
+        ibar = lltype.malloc(IBAR, flavor='raw', immortal=True)
+        ibar.p = foo
+
+        BARI = lltype.Struct('BARI', ('b', lltype.Ptr(IBAR)))
+        bari = lltype.malloc(BARI, flavor='raw', immortal=True)
+        bari.b = ibar
+
         def main(argv):
             assert bar.p == foo
             assert baz.p == foo
@@ -41,6 +50,8 @@
                 assert vbar[i] == foo
             assert recbar.q == foo
             assert recbar.super.p == foo
+            assert ibar.p == foo
+            assert bari.b == ibar
             revdb.stop_point()
             return 9
 


More information about the pypy-commit mailing list