def prepare_to_run(self):
        ''' Shared code to prepare debugging by installing traces and registering threads '''
        self.patch_threads()

        PyDBCommandThread(self).start()
        if self.redirect_output or self.signature_factory is not None or self.thread_analyser is not None:
            # we need all data to be sent to IDE even after program finishes
            CheckOutputThread(self).start()
 Shared code to prepare debugging by installing traces and registering threads 
debugger/src/pydevd.py