Author: Armin Rigo <[email protected]>
Branch: reverse-debugger
Changeset: r85542:79bf6fc209bb
Date: 2016-07-04 18:52 +0200
http://bitbucket.org/pypy/pypy/changeset/79bf6fc209bb/

Log:    Next fix

diff --git a/pypy/interpreter/reverse_debugging.py 
b/pypy/interpreter/reverse_debugging.py
--- a/pypy/interpreter/reverse_debugging.py
+++ b/pypy/interpreter/reverse_debugging.py
@@ -458,14 +458,15 @@
     dbstate.breakpoint_stack_id = cmd.c_arg1
     funcnames = None
     watch_progs = []
-    for i, kind, name in revdb.split_breakpoints_arg(extra):
-        if kind == 'B':
-            if funcnames is None:
-                funcnames = {}
-            funcnames[name] = i
-        elif kind == 'W':
-            code = interp_marshal.loads(space, space.wrap(name))
-            watch_progs.append((code, i, ''))
+    with non_standard_code:
+        for i, kind, name in revdb.split_breakpoints_arg(extra):
+            if kind == 'B':
+                if funcnames is None:
+                    funcnames = {}
+                funcnames[name] = i
+            elif kind == 'W':
+                code = interp_marshal.loads(space, space.wrap(name))
+                watch_progs.append((code, i, ''))
     dbstate.breakpoint_funcnames = funcnames
     dbstate.watch_progs = watch_progs[:]
 lambda_breakpoints = lambda: command_breakpoints
diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py
--- a/pypy/module/__pypy__/__init__.py
+++ b/pypy/module/__pypy__/__init__.py
@@ -91,6 +91,7 @@
                           'interp_magic.save_module_content_for_future_reload',
         'decode_long'               : 'interp_magic.decode_long',
         '_promote'                   : 'interp_magic._promote',
+        'side_effects_ok'           : 'interp_magic.side_effects_ok',
     }
     if sys.platform == 'win32':
         interpleveldefs['get_console_cp'] = 'interp_magic.get_console_cp'
diff --git a/pypy/module/__pypy__/interp_magic.py 
b/pypy/module/__pypy__/interp_magic.py
--- a/pypy/module/__pypy__/interp_magic.py
+++ b/pypy/module/__pypy__/interp_magic.py
@@ -188,3 +188,19 @@
     else:
         jit.promote(w_obj)
     return w_obj
+
+def side_effects_ok(space):
+    """For use with the reverse-debugger: this function normally returns
+    True, but will return False if we are evaluating a debugging command
+    like a watchpoint.  You are responsible for not doing any side effect
+    at all (including no caching) when evaluating watchpoints.  This
+    function is meant to help a bit---you can write:
+
+        if not __pypy__.side_effects_ok():
+            skip the caching logic
+
+    inside getter methods or properties, to make them usable from
+    watchpoints.  Note that you need to re-run ``PYPYRDB=.. pypy''
+    after changing the Python code.
+    """
+    return space.wrap(space._side_effects_ok())
diff --git a/rpython/translator/revdb/process.py 
b/rpython/translator/revdb/process.py
--- a/rpython/translator/revdb/process.py
+++ b/rpython/translator/revdb/process.py
@@ -136,6 +136,7 @@
                               breakpoints_cache=self.breakpoints_cache,
                               printed_objects=self.printed_objects)
         other.expect_ready()
+        #print >> sys.stderr, 'CLONED', self.current_time
         return other
 
     def close(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to