Author: Armin Rigo <[email protected]>
Branch: reverse-debugger
Changeset: r85535:62906323fc67
Date: 2016-07-04 14:06 +0200
http://bitbucket.org/pypy/pypy/changeset/62906323fc67/

Log:    tweaks, watchpoints still crash in pypy

diff --git a/pypy/interpreter/executioncontext.py 
b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -494,6 +494,7 @@
     """The normal class for space.actionflag.  The signal module provides
     a different one."""
     _ticker = 0
+    _ticker_count = -1     # xxx only for reverse_debugger.py
 
     def get_ticker(self):
         return self._ticker
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
@@ -191,9 +191,11 @@
 class NonStandardCode(object):
     def __enter__(self):
         dbstate.standard_code = False
-        self.c = dbstate.space.actionflag._ticker_cache
+        self.t = dbstate.space.actionflag._ticker
+        self.c = dbstate.space.actionflag._ticker_count
     def __exit__(self, *args):
-        dbstate.space.actionflag._ticker_cache = self.c
+        dbstate.space.actionflag._ticker = self.t
+        dbstate.space.actionflag._ticker_count = self.c
         dbstate.standard_code = True
 non_standard_code = NonStandardCode()
 
@@ -206,17 +208,18 @@
             for prog, watch_id, expected in dbstate.watch_progs:
                 any_watch_point = True
                 try:
-                    if _run_watch(space, prog) != expected:
-                        break
+                    got = _run_watch(space, prog)
+                except OperationError as e:
+                    got = e.errorstr(space)
                 except Exception:
                     break
+                if got != expected:
+                    break
             else:
                 watch_id = -1
         revdb.watch_restore_state(any_watch_point)
         if watch_id != -1:
             revdb.breakpoint(watch_id)
-    elif not dbstate.standard_code:
-        return
     revdb.stop_point()
 
 
@@ -566,17 +569,17 @@
     # bytecodes, at the expense of not reacting to signals instantly.
 
     _SIG_TICKER_COUNT = 100
-    _ticker_cache = 0
+    _ticker = 0
     _ticker_count = _SIG_TICKER_COUNT * 10
 
     def get_ticker(self):
-        return self._ticker_cache
+        return self._ticker
 
     def reset_ticker(self, value):
-        self._ticker_cache = value
+        self._ticker = value
 
     def rearm_ticker(self):
-        self._ticker_cache = -1
+        self._ticker = -1
 
     def decrement_ticker(self, by):
         if we_are_translated():
@@ -588,7 +591,7 @@
             print ("RDBSignalActionFlag: has_bytecode_counter: "
                    "not supported for now")
             raise NotImplementedError
-        return self._ticker_cache
+        return self._ticker
 
     def _update_ticker_from_signals(self):
         from rpython.rlib import rsignal
diff --git a/pypy/module/signal/__init__.py b/pypy/module/signal/__init__.py
--- a/pypy/module/signal/__init__.py
+++ b/pypy/module/signal/__init__.py
@@ -46,10 +46,7 @@
         space.check_signal_action = interp_signal.CheckSignalAction(space)
         space.actionflag.register_periodic_action(space.check_signal_action,
                                                   use_bytecode_counter=False)
-        if space.config.translation.reverse_debugger:
-            from pypy.interpreter.reverse_debugging import RDBSignalActionFlag
-            space.actionflag.__class__ = RDBSignalActionFlag
-        else:
+        if not space.config.translation.reverse_debugger:
             space.actionflag.__class__ = interp_signal.SignalActionFlag
         # xxx yes I know the previous line is a hack
 
diff --git a/rpython/translator/revdb/interact.py 
b/rpython/translator/revdb/interact.py
--- a/rpython/translator/revdb/interact.py
+++ b/rpython/translator/revdb/interact.py
@@ -35,6 +35,7 @@
             if last_time != previous_time:
                 print
                 self.pgroup.update_watch_values()
+                last_time = self.pgroup.get_current_time()
             if self.print_extra_pending_info:
                 print self.print_extra_pending_info
                 self.print_extra_pending_info = None
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
@@ -399,7 +399,13 @@
         self.active.breakpoints_cache = self.all_breakpoints.duplicate()
 
     def update_watch_values(self):
-        self._update_watchpoints_uids()
+        try:
+            self._update_watchpoints_uids()
+        except socket.error as e:
+            print >> sys.stderr, "socket.error: %s" % (e,)
+            print >> sys.stderr, "restarting at position 1"
+            self.jump_in_time(1)
+            self._update_watchpoints_uids()
         seen = set()
         for num, name in self.all_breakpoints.num2break.items():
             if name.startswith('W'):
@@ -507,9 +513,9 @@
             except IndexError:
                 continue
             if skip_futures and uid >= self.get_currently_created_objects():
-                print >> sys.stderr, (
-                    "note: '$%d' refers to an object that is "
-                    "only created later in time" % nid)
+                #print >> sys.stderr, (
+                #    "note: '$%d' refers to an object that is "
+                #    "only created later in time" % nid)
                 continue
             uids.append(uid)
         return uids
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to