Author: Armin Rigo <[email protected]>
Branch: reverse-debugger
Changeset: r85237:ec6332290eb6
Date: 2016-06-20 12:09 +0200
http://bitbucket.org/pypy/pypy/changeset/ec6332290eb6/
Log: Reimplement 'tainting'
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
@@ -20,7 +20,7 @@
self.pgroup = ReplayProcessGroup(executable, revdb_log_filename)
def interact(self):
- last_command = ''
+ last_command = 'help'
while True:
last_time = self.pgroup.get_current_time()
prompt = '(%d)$ ' % last_time
@@ -65,7 +65,8 @@
def command_go(self, argument):
"""Jump to time ARG"""
- self.pgroup.jump_in_time(int(argument))
+ arg = int(argument or self.pgroup.get_current_time())
+ self.pgroup.jump_in_time(arg)
def command_info(self, argument):
"""Display various info ('info help' for more)"""
@@ -89,7 +90,10 @@
def command_step(self, argument):
"""Run forward ARG steps (default 1)"""
arg = int(argument or '1')
- self.pgroup.go_forward(arg)
+ if self.pgroup.is_tainted():
+ self.pgroup.jump_in_time(self.pgroup.get_current_time() + arg)
+ else:
+ self.pgroup.go_forward(arg)
command_s = command_step
def command_bstep(self, argument):
@@ -100,7 +104,7 @@
def command_continue(self, argument):
"""Run forward"""
- self.pgroup.go_forward(maxint64)
+ self.pgroup.jump_in_time(maxint64)
command_c = command_continue
def command_print(self, argument):
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
@@ -20,6 +20,7 @@
def __init__(self, pid, control_socket):
self.pid = pid
self.control_socket = control_socket
+ self.tainted = False
def _recv_all(self, size):
pieces = []
@@ -83,6 +84,7 @@
def forward(self, steps):
"""Move this subprocess forward in time."""
+ assert not self.tainted
self.send(Message(CMD_FORWARD, steps))
#
msg = self.recv()
@@ -152,11 +154,15 @@
next_time = latest_done + int(self.STEP_RATIO * range_not_done) + 1
return next_time
+ def is_tainted(self):
+ return self.active.tainted
+
def go_forward(self, steps):
"""Go forward, for the given number of 'steps' of time.
If needed, it will leave clones at intermediate times.
- Does not close the active subprocess.
+ Does not close the active subprocess. Note that
+ is_tainted() must return false in order to use this.
"""
assert steps >= 0
while True:
@@ -201,6 +207,7 @@
def print_cmd(self, expression):
"""Print an expression.
"""
+ self.active.tainted = True
self.active.send(Message(CMD_PRINT, extra=expression))
self.active.print_text_answer()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit