Example #1
0
                self._hooks.append(_GDBHook.get_hook(command))

        def connect(self, _callable):
            assert _callable is not None

            for hook in self._hooks:
                def callback(*args):
                    _ContinueEventRegistry._event_callback(_callable, *args)

                #callback = lambda a1, a2, a3, a4, a5, a6, a7, a8, a9, a10: _callable
                hook.add_callback(callback)
                self._callables_to_callbacks[_callable] = callback

        def disconnect(self, _callable):
            callback = self._callables_to_callbacks.pop(_callable, None)

            assert callback is not None

            for hook in self._hooks:
                hook.remove_callback(callback)

        @staticmethod
        def _event_callback(_callable, *args):
            # We probably don't have enough info to do a real
            # ThreadEvent object, so always return an empty one
            _callable(_ThreadEvent())

    events.ThreadEvent = _ThreadEvent
    events.ContinueEvent = _ContinueEvent
    events.EventRegistry = _EventRegistry
    events.cont = _ContinueEventRegistry()