1.1 --- a/rsvp.py Sun Feb 20 19:31:50 2011 +0100
1.2 +++ b/rsvp.py Fri Feb 25 01:45:02 2011 +0100
1.3 @@ -174,8 +174,8 @@
1.4 print "Result", self.result
1.5 print "Exception", self.exception
1.6
1.7 - def show(self):
1.8 - self.show_memory(self.memory, self.coverage, 0)
1.9 + def show(self, start=None, end=None):
1.10 + self.show_memory(self.memory[start:end], self.coverage[start:end], start or 0)
1.11
1.12 def show_pc(self, run_in=10):
1.13 start = max(0, self.pc - run_in)
1.14 @@ -204,6 +204,15 @@
1.15 def set_break(self, location):
1.16 self.breakpoints.add(location)
1.17
1.18 + def up(self):
1.19 + retaddr = self.pc_stack[-1]
1.20 + new_breakpoint = retaddr not in self.breakpoints
1.21 + if new_breakpoint:
1.22 + self.set_break(retaddr)
1.23 + self.run()
1.24 + if new_breakpoint:
1.25 + self.breakpoints.remove(retaddr)
1.26 +
1.27 # Internal operations.
1.28
1.29 def load(self, address):
1.30 @@ -271,7 +280,7 @@
1.31 print "Execution terminated",
1.32 if self.exception is not None:
1.33 ref = self.exception
1.34 - addr = self.load(ref + 1)
1.35 + addr = self.load(ref + Library.instance_data_offset)
1.36 print "with exception:", self.load(ref)
1.37 print "At address %d: %r" % (addr, self.load(addr))
1.38 elif breakpoint:
1.39 @@ -497,7 +506,7 @@
1.40 self.value = self.load(value.ref + offset)
1.41 return
1.42
1.43 - self.exception = self._MakeObject(2, self.attr_error_instance)
1.44 + self.exception = self._MakeObject(Library.instance_size, self.attr_error_instance)
1.45 return self.RaiseException()
1.46
1.47 # LoadAttrIndexContext not defined.
1.48 @@ -520,7 +529,7 @@
1.49 self.value = self.load(inst_value.ref + offset)
1.50 return
1.51
1.52 - self.exception = self._MakeObject(2, self.attr_error_instance)
1.53 + self.exception = self._MakeObject(Library.instance_size, self.attr_error_instance)
1.54 return self.RaiseException()
1.55
1.56 def StoreAttrIndex(self):
1.57 @@ -532,13 +541,13 @@
1.58 attr_index, static_attr, offset = element
1.59 if attr_index == self.operand:
1.60 if static_attr:
1.61 - self.exception = self._MakeObject(2, self.type_error_instance)
1.62 + self.exception = self._MakeObject(Library.instance_size, self.type_error_instance)
1.63 return self.RaiseException()
1.64 else:
1.65 self.save(value.ref + offset, self.source)
1.66 return
1.67
1.68 - self.exception = self._MakeObject(2, self.attr_error_instance)
1.69 + self.exception = self._MakeObject(Library.instance_size, self.attr_error_instance)
1.70 return self.RaiseException()
1.71
1.72 # NOTE: LoadAttrIndexContext is a possibility if a particular attribute can always be overridden.
1.73 @@ -569,7 +578,7 @@
1.74 self.frame_stack[frame + offset] = self.source
1.75 return
1.76
1.77 - self.exception = self._MakeObject(2, self.type_error_instance)
1.78 + self.exception = self._MakeObject(Library.instance_size, self.type_error_instance)
1.79 return self.RaiseException()
1.80
1.81 def LoadCallable(self):
1.82 @@ -618,7 +627,7 @@
1.83
1.84 if not ((nargs - ndefaults) <= nlocals):
1.85 raise Exception, "CheckFrame %r (%r <= %r <= %r)" % (self.operand, nargs - ndefaults, nlocals, nargs)
1.86 - self.exception = self._MakeObject(2, self.type_error_instance)
1.87 + self.exception = self._MakeObject(Library.instance_size, self.type_error_instance)
1.88 return self.RaiseException()
1.89
1.90 def CheckExtra(self):
1.91 @@ -742,8 +751,8 @@
1.92 self.exception = None
1.93
1.94 def RaiseException(self):
1.95 - # NOTE: Adding the program counter as the first attribute.
1.96 - self.save(self.exception + 1, self.pc)
1.97 + # NOTE: Adding the program counter as the first attribute after __class__.
1.98 + self.save(self.exception + 2, self.pc)
1.99 # Jumping to the current handler.
1.100 if self.abort_upon_exception:
1.101 raise Exception