def expose_primitive(self, wrap_func=None, **kwargs): original_decorator = Plugin.expose_primitive(self, wrap_func=wrap_func, **kwargs) def decorator(func): original_decorator(func) wrapped = self.primitives[func.func_name] def catchall(interp, s_frame, argcount, w_method=None): try: return wrapped(interp, s_frame, argcount, w_method=w_method) except rsocket.SocketError as e: print "!!!SOCKET ERROR!!!" print e.get_msg() print "!!!SOCKET ERROR!!!" raise error.PrimitiveFailedError catchall.func_name = "catchall_" + wrapped.func_name self.primitives[func.func_name] = catchall return func return decorator
def wrappedcall(self, name, interp, s_frame, argcount, w_method): import time # sys.stdout.write("%s(%s): " % (name, s_frame.peek_n(argcount))) print name if "Socket" in name: time.sleep(0.5) r = Plugin.call(self, name, interp, s_frame, argcount, w_method) # print r return r
def expose_primitive(self, wrap_func=None, **kwargs): if not self.is_enabled(): return lambda x: x # do not install primitives when disabled original_decorator = Plugin.expose_primitive(self, wrap_func=wrap_func, **kwargs) def decorator(func): original_decorator(func) wrapped = self.primitives[func.func_name] def catchall(interp, s_frame, argcount, w_method=None): try: return wrapped(interp, s_frame, argcount, w_method=w_method) except rsocket.SocketError as e: print "!!!SOCKET ERROR!!!" print e.get_msg() print "!!!SOCKET ERROR!!!" raise error.PrimitiveFailedError catchall.func_name = "catchall_" + wrapped.func_name self.primitives[func.func_name] = catchall return func return decorator
def is_enabled(self): return Plugin.is_enabled(self) and IS_WINDOWS
def __init__(self): Plugin.__init__(self) self.ascii_order = Cell(None)
def __init__(self): Plugin.__init__(self) self.register_default_primitives() self._break_on_exceptions_during_sends = Cell(False)
import os from rsqueakvm import model, error from rsqueakvm.plugins.plugin import Plugin from rsqueakvm.util.system import IS_WINDOWS DebuggingPlugin = Plugin() DebuggingPlugin.userdata['stop_ui'] = False def stop_ui_process(): DebuggingPlugin.userdata['stop_ui'] = True # @DebuggingPlugin.expose_primitive(unwrap_spec=[object]) # def trace(interp, s_frame, w_rcvr): # interp.trace = True # return w_rcvr # @DebuggingPlugin.expose_primitive(unwrap_spec=[object]) # def untrace(interp, s_frame, w_rcvr): # interp.trace = False # return w_rcvr if IS_WINDOWS: def fork(): raise NotImplementedError("fork on windows") else: fork = os.fork @DebuggingPlugin.expose_primitive(unwrap_spec=[object])
def __init__(self): Plugin.__init__(self) self.last_lookup = Cell(None)
def is_enabled(self): return Plugin.is_enabled(self) and not IS_WINDOWS
def __init__(self): Plugin.__init__(self) self.w_ruby_object_class = QuasiConstant(None, cls=W_AbstractObjectWithIdentityHash) self.w_ruby_plugin_send = QuasiConstant(None, cls=W_AbstractObjectWithIdentityHash)