Main debugging class Lots of stuff going on here: PyDB starts two threads on startup that connect to remote debugger (RDB) The threads continuously read & write commands to RDB. PyDB communicates with these threads through command queues. Every RDB command is processed by cal
| 555 | |
| 556 | |
| 557 | class PyDB(object): |
| 558 | """Main debugging class |
| 559 | Lots of stuff going on here: |
| 560 | |
| 561 | PyDB starts two threads on startup that connect to remote debugger (RDB) |
| 562 | The threads continuously read & write commands to RDB. |
| 563 | PyDB communicates with these threads through command queues. |
| 564 | Every RDB command is processed by calling process_net_command. |
| 565 | Every PyDB net command is sent to the net by posting NetCommand to WriterThread queue |
| 566 | |
| 567 | Some commands need to be executed on the right thread (suspend/resume & friends) |
| 568 | These are placed on the internal command queue. |
| 569 | """ |
| 570 | |
| 571 | # Direct child pids which should not be terminated when terminating processes. |
| 572 | # Note: class instance because it should outlive PyDB instances. |
| 573 | dont_terminate_child_pids = set() |
| 574 | |
| 575 | def __init__(self, set_as_global=True): |
| 576 | if set_as_global: |
| 577 | pydevd_tracing.replace_sys_set_trace_func() |
| 578 | |
| 579 | self.authentication = _Authentication() |
| 580 | |
| 581 | self.reader = None |
| 582 | self.writer = None |
| 583 | self._fsnotify_thread = None |
| 584 | self.created_pydb_daemon_threads = {} |
| 585 | self._waiting_for_connection_thread = None |
| 586 | self._on_configuration_done_event = ThreadingEvent() |
| 587 | self.check_alive_thread = None |
| 588 | self.py_db_command_thread = None |
| 589 | self.quitting = None |
| 590 | self.cmd_factory = NetCommandFactory() |
| 591 | self._cmd_queue = defaultdict(_queue.Queue) # Key is thread id or '*', value is Queue |
| 592 | self._thread_events = defaultdict(ThreadingEvent) # Key is thread id or '*', value is Event |
| 593 | self.suspended_frames_manager = SuspendedFramesManager() |
| 594 | self._files_filtering = FilesFiltering() |
| 595 | self.timeout_tracker = TimeoutTracker(self) |
| 596 | |
| 597 | # Note: when the source mapping is changed we also have to clear the file types cache |
| 598 | # (because if a given file is a part of the project or not may depend on it being |
| 599 | # defined in the source mapping). |
| 600 | self.source_mapping = SourceMapping(on_source_mapping_changed=self._clear_caches) |
| 601 | |
| 602 | # Determines whether we should terminate child processes when asked to terminate. |
| 603 | self.terminate_child_processes = True |
| 604 | |
| 605 | # Determines whether we should try to do a soft terminate (i.e.: interrupt the main |
| 606 | # thread with a KeyboardInterrupt). |
| 607 | self.terminate_keyboard_interrupt = False |
| 608 | |
| 609 | # Set to True after a keyboard interrupt is requested the first time. |
| 610 | self.keyboard_interrupt_requested = False |
| 611 | |
| 612 | # These are the breakpoints received by the PyDevdAPI. They are meant to store |
| 613 | # the breakpoints in the api -- its actual contents are managed by the api. |
| 614 | self.api_received_breakpoints = {} |
no outgoing calls