debugpy 1.8.5__zip → 1.8.6__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. {debugpy-1.8.5/src/debugpy.egg-info → debugpy-1.8.6}/PKG-INFO +1 -1
  2. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_calltip_util.py +19 -21
  3. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_completer.py +30 -30
  4. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_execfile.py +3 -1
  5. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_filesystem_encoding.py +43 -0
  6. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_getopt.py +35 -32
  7. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_imports_tipper.py +83 -84
  8. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_jy_imports_tipper.py +92 -99
  9. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_log.py +2 -3
  10. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_saved_modules.py +51 -27
  11. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_sys_patch.py +11 -7
  12. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_tipper_common.py +6 -5
  13. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/fsnotify/__init__.py +34 -38
  14. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_console_utils.py +71 -69
  15. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_import_hook.py +1 -3
  16. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_imports.py +0 -1
  17. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_ipython_console.py +14 -16
  18. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_ipython_console_011.py +81 -93
  19. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_is_thread_alive.py +3 -3
  20. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_localhost.py +9 -8
  21. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_log.py +33 -25
  22. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py +183 -170
  23. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey_qt.py +33 -29
  24. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_override.py +6 -4
  25. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_umd.py +19 -18
  26. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_versioncheck.py +3 -3
  27. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles.py +165 -138
  28. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_coverage.py +77 -0
  29. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_nose.py +35 -36
  30. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_parallel.py +22 -23
  31. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_parallel_client.py +37 -57
  32. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_pytest2.py +54 -52
  33. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_unittest.py +28 -37
  34. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_xml_rpc.py +56 -53
  35. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/__main__pydevd_gen_debug_adapter_protocol.py +604 -0
  36. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/debugProtocol.json +551 -445
  37. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_base_schema.py +25 -29
  38. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py +17458 -0
  39. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema_log.py +11 -12
  40. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevconsole_code.py +18 -19
  41. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py +41 -0
  42. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py +327 -0
  43. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_api.py +263 -214
  44. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_breakpoints.py +7 -10
  45. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_bytecode_utils.py +187 -92
  46. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_bytecode_utils_py311.py +105 -0
  47. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_code_to_source.py +46 -51
  48. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_collect_bytecode_info.py +239 -176
  49. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py +370 -297
  50. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm_constants.py +78 -86
  51. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_command_line_handling.py +55 -59
  52. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_concurrency_analyser/pydevd_concurrency_logger.py +194 -58
  53. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_concurrency_analyser/pydevd_thread_wrappers.py +2 -3
  54. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_console.py +18 -23
  55. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_constants.py +157 -127
  56. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_custom_frames.py +10 -12
  57. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.c +35217 -23106
  58. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.pxd +15 -0
  59. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.pyx +802 -511
  60. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py +18 -7
  61. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_daemon_thread.py +32 -24
  62. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_defaults.py +11 -13
  63. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_dont_trace.py +16 -16
  64. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_dont_trace_files.py +27 -2
  65. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_exec2.py +1 -1
  66. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_extension_api.py +4 -5
  67. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_extension_utils.py +8 -10
  68. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_filtering.py +50 -45
  69. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py +462 -407
  70. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame_utils.py +63 -61
  71. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_gevent_integration.py +14 -16
  72. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_import_class.py +27 -25
  73. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_io.py +40 -42
  74. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_json_debug_options.py +200 -0
  75. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py +20 -19
  76. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py +199 -108
  77. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_xml.py +121 -73
  78. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_plugin_utils.py +208 -0
  79. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command.py +206 -159
  80. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py +346 -334
  81. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_referrers.py +75 -80
  82. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_reload.py +35 -35
  83. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py +116 -124
  84. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py +44 -58
  85. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py +51 -55
  86. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_save_locals.py +4 -2
  87. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_signature.py +24 -24
  88. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_source_mapping.py +19 -20
  89. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_stackless.py +45 -49
  90. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_suspended_frames.py +61 -58
  91. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_thread_lifecycle.py +23 -13
  92. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_timeout.py +29 -31
  93. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_trace_dispatch.py +41 -11
  94. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_trace_dispatch_regular.py +117 -55
  95. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_traceproperty.py +11 -14
  96. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_utils.py +90 -89
  97. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py +106 -97
  98. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vm_type.py +40 -0
  99. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_xml.py +56 -46
  100. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_eval_cython_wrapper.py +5 -5
  101. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py +71 -0
  102. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.c +11165 -5326
  103. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_tracing.py +5 -6
  104. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_modify_bytecode.py +53 -56
  105. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/__init__.py +1 -0
  106. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/bytecode.py +4 -6
  107. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/cfg.py +6 -26
  108. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/concrete.py +7 -21
  109. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/flags.py +5 -24
  110. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/instr.py +10 -34
  111. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/peephole_opt.py +1 -4
  112. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/__init__.py +2 -6
  113. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_bytecode.py +3 -5
  114. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_cfg.py +11 -31
  115. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_code.py +2 -2
  116. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_concrete.py +14 -41
  117. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_flags.py +2 -4
  118. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_instr.py +7 -18
  119. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_misc.py +6 -18
  120. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/test_peephole_opt.py +7 -18
  121. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/util_annotation.py +1 -3
  122. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/pydevd_fix_code.py +14 -19
  123. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring.py +1927 -0
  124. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring_cython.c +43058 -0
  125. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring_cython.pxd +46 -0
  126. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring_cython.pyx +1934 -0
  127. debugpy-1.8.6/src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/pydevd_sys_monitoring.py +16 -0
  128. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_app_engine_debug_startup.py +12 -11
  129. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_coverage.py +30 -32
  130. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhook.py +58 -54
  131. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookglut.py +20 -24
  132. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookgtk.py +8 -7
  133. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookgtk3.py +8 -6
  134. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookpyglet.py +11 -8
  135. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookqt4.py +21 -18
  136. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookqt5.py +17 -15
  137. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookqt6.py +17 -15
  138. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhooktk.py +6 -4
  139. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/inputhookwx.py +14 -10
  140. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py +30 -26
  141. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydev_ipython/qt.py +24 -0
  142. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/qt_for_kernel.py +37 -34
  143. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/qt_loaders.py +86 -73
  144. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/version.py +7 -7
  145. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydev_pysrc.py +1 -0
  146. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_run_in_console.py +23 -24
  147. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydev_sitecustomize/sitecustomize.py +267 -0
  148. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevconsole.py +55 -47
  149. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd.py +732 -508
  150. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_always_live_program.py +40 -0
  151. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_check.py +1 -0
  152. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process.py +11 -0
  153. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py +75 -0
  154. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py +130 -125
  155. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll +0 -0
  156. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb +0 -0
  157. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_pydevd.py +89 -0
  158. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_script.py +41 -32
  159. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll +0 -0
  160. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb +0 -0
  161. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_utils.hpp +1 -0
  162. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_version.hpp +9 -1
  163. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe +0 -0
  164. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb +0 -0
  165. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.exe +0 -0
  166. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb +0 -0
  167. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/lldb_prepare.py +10 -9
  168. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll +0 -0
  169. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb +0 -0
  170. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll +0 -0
  171. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb +0 -0
  172. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/__init__.py +103 -119
  173. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/breakpoint.py +457 -516
  174. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/compat.py +33 -15
  175. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/crash.py +336 -281
  176. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/debug.py +101 -131
  177. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/disasm.py +148 -153
  178. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/event.py +310 -302
  179. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/interactive.py +235 -208
  180. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/module.py +185 -218
  181. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/process.py +428 -564
  182. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/registry.py +54 -53
  183. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/search.py +69 -73
  184. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/sql.py +158 -170
  185. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/system.py +143 -213
  186. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/textio.py +302 -333
  187. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/thread.py +220 -239
  188. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/util.py +198 -177
  189. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/__init__.py +11 -11
  190. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/advapi32.py +1191 -713
  191. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/context_amd64.py +248 -194
  192. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/context_i386.py +132 -120
  193. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/dbghelp.py +450 -346
  194. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/defines.py +305 -286
  195. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/gdi32.py +526 -0
  196. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/kernel32.py +1479 -1097
  197. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/ntdll.py +579 -0
  198. debugpy-1.8.6/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/peb_teb.py +3517 -0
  199. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/psapi.py +54 -31
  200. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/shell32.py +170 -149
  201. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/shlwapi.py +190 -108
  202. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/user32.py +542 -437
  203. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/version.py +489 -442
  204. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/wtsapi32.py +83 -65
  205. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/window.py +70 -76
  206. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/attach.cpp +17 -9
  207. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/compile_windows.bat +1 -1
  208. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_file_utils.py +141 -120
  209. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/__init__.py +1 -0
  210. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/django_debug.py +175 -149
  211. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/__init__.py +1 -0
  212. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/__init__.py +1 -0
  213. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_helpers.py +5 -5
  214. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py +28 -28
  215. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_plugin_pandas_types.py +22 -30
  216. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_plugins_django_form_str.py +3 -2
  217. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/jinja2_debug.py +130 -108
  218. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/pydevd_line_validation.py +27 -14
  219. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_tracing.py +85 -66
  220. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/setup_pydevd_cython.py +96 -59
  221. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_version.py +3 -3
  222. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/messaging.py +2 -1
  223. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/server/cli.py +32 -17
  224. {debugpy-1.8.5 → debugpy-1.8.6/src/debugpy.egg-info}/PKG-INFO +1 -1
  225. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy.egg-info/SOURCES.txt +6 -1
  226. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_filesystem_encoding.py +0 -41
  227. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydev_runfiles/pydev_runfiles_coverage.py +0 -76
  228. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/__main__pydevd_gen_debug_adapter_protocol.py +0 -592
  229. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py +0 -19514
  230. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py +0 -19
  231. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py +0 -153
  232. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_json_debug_options.py +0 -204
  233. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_plugin_utils.py +0 -91
  234. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_trace_api.py +0 -62
  235. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vm_type.py +0 -41
  236. debugpy-1.8.5/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py +0 -48
  237. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydev_ipython/qt.py +0 -23
  238. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydev_pysrc.py +0 -1
  239. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydev_sitecustomize/sitecustomize.py +0 -237
  240. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_always_live_program.py +0 -32
  241. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process.py +0 -9
  242. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py +0 -74
  243. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll +0 -0
  244. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.pdb +0 -0
  245. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_pydevd.py +0 -79
  246. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll +0 -0
  247. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_x86.pdb +0 -0
  248. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.exe +0 -0
  249. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_amd64.pdb +0 -0
  250. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/inject_dll_x86.pdb +0 -0
  251. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.dll +0 -0
  252. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_amd64.pdb +0 -0
  253. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.dll +0 -0
  254. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/run_code_on_dllmain_x86.pdb +0 -0
  255. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/gdi32.py +0 -507
  256. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/ntdll.py +0 -539
  257. debugpy-1.8.5/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/peb_teb.py +0 -3435
  258. {debugpy-1.8.5 → debugpy-1.8.6}/DESCRIPTION.md +0 -0
  259. {debugpy-1.8.5 → debugpy-1.8.6}/LICENSE +0 -0
  260. {debugpy-1.8.5 → debugpy-1.8.6}/MANIFEST.in +0 -0
  261. {debugpy-1.8.5 → debugpy-1.8.6}/README.md +0 -0
  262. {debugpy-1.8.5 → debugpy-1.8.6}/pyproject.toml +0 -0
  263. {debugpy-1.8.5 → debugpy-1.8.6}/setup.cfg +0 -0
  264. {debugpy-1.8.5 → debugpy-1.8.6}/setup.py +0 -0
  265. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/ThirdPartyNotices.txt +0 -0
  266. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/__init__.py +0 -0
  267. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/__main__.py +0 -0
  268. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/__init__.py +0 -0
  269. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/_pydevd_packaging.py +0 -0
  270. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/_util.py +0 -0
  271. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/force_pydevd.py +0 -0
  272. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_bundle/__init__.py +0 -0
  273. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydev_runfiles/__init__.py +0 -0
  274. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/__init__.py +0 -0
  275. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/__init__.py +0 -0
  276. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/debugProtocolCustom.json +0 -0
  277. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_concurrency_analyser/__init__.py +0 -0
  278. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/.gitignore +0 -0
  279. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/__init__.py +0 -0
  280. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pxd +0 -0
  281. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pyx +0 -0
  282. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.template.pyx +0 -0
  283. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/release_mem.h +0 -0
  284. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/README.txt +0 -0
  285. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/__init__.py +0 -0
  286. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/README +0 -0
  287. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_ipython/__init__.py +0 -0
  288. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydev_sitecustomize/__not_in_default_pythonpath.txt +0 -0
  289. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/README.txt +0 -0
  290. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace.hpp +0 -0
  291. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace_310.hpp +0 -0
  292. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace_311.hpp +0 -0
  293. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_custom_pyeval_settrace_common.hpp +0 -0
  294. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_settrace.hpp +0 -0
  295. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/python.h +0 -0
  296. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/ref_utils.hpp +0 -0
  297. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/.gitignore +0 -0
  298. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/attach.cpp +0 -0
  299. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_linux.sh +0 -0
  300. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh +0 -0
  301. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_manylinux.cmd +0 -0
  302. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/attach.h +0 -0
  303. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/inject_dll.cpp +0 -0
  304. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/py_win_helpers.hpp +0 -0
  305. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/run_code_in_memory.hpp +0 -0
  306. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/run_code_on_dllmain.cpp +0 -0
  307. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/stdafx.cpp +0 -0
  308. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/stdafx.h +0 -0
  309. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/targetver.h +0 -0
  310. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/_vendored/pydevd/pydevd_plugins/extensions/README.md +0 -0
  311. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/adapter/__init__.py +0 -0
  312. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/adapter/__main__.py +0 -0
  313. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/adapter/clients.py +0 -0
  314. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/adapter/components.py +0 -0
  315. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/adapter/launchers.py +0 -0
  316. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/adapter/servers.py +0 -0
  317. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/adapter/sessions.py +0 -0
  318. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/__init__.py +0 -0
  319. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/json.py +0 -0
  320. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/log.py +0 -0
  321. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/singleton.py +0 -0
  322. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/sockets.py +0 -0
  323. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/stacks.py +0 -0
  324. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/timestamp.py +0 -0
  325. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/common/util.py +0 -0
  326. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/launcher/__init__.py +0 -0
  327. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/launcher/__main__.py +0 -0
  328. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/launcher/debuggee.py +0 -0
  329. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/launcher/handlers.py +0 -0
  330. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/launcher/output.py +0 -0
  331. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/launcher/winapi.py +0 -0
  332. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/public_api.py +0 -0
  333. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/server/__init__.py +0 -0
  334. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/server/api.py +0 -0
  335. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy/server/attach_pid_injected.py +0 -0
  336. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy.egg-info/dependency_links.txt +0 -0
  337. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy.egg-info/entry_points.txt +0 -0
  338. {debugpy-1.8.5 → debugpy-1.8.6}/src/debugpy.egg-info/top_level.txt +0 -0
  339. {debugpy-1.8.5 → debugpy-1.8.6}/versioneer.py +0 -0
@@ -1,11 +1,14 @@
1
- '''
1
+ """
2
2
  Entry point module (keep at root):
3
3
 
4
4
  This module starts the debugger.
5
- '''
5
+ """
6
6
  import sys # @NoMove
7
+
7
8
  if sys.version_info[:2] < (3, 6):
8
- raise RuntimeError('The PyDev.Debugger requires Python 3.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.')
9
+ raise RuntimeError(
10
+ "The PyDev.Debugger requires Python 3.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger."
11
+ )
9
12
  import os
10
13
 
11
14
  try:
@@ -20,6 +23,8 @@ except ImportError:
20
23
  # Import this first as it'll check for shadowed modules and will make sure that we import
21
24
  # things as needed for gevent.
22
25
  from _pydevd_bundle import pydevd_constants
26
+ from typing import Optional, Tuple
27
+ from types import FrameType
23
28
 
24
29
  import atexit
25
30
  import dis
@@ -34,29 +39,63 @@ import getpass as getpass_mod
34
39
  import functools
35
40
 
36
41
  import pydevd_file_utils
42
+ from _pydevd_bundle.pydevd_dont_trace_files import LIB_FILES_IN_DONT_TRACE_DIRS
37
43
  from _pydev_bundle import pydev_imports, pydev_log
38
44
  from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
39
45
  from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
40
46
  from _pydev_bundle.pydev_override import overrides
41
- from _pydev_bundle._pydev_saved_modules import threading, time, thread
47
+ from _pydev_bundle._pydev_saved_modules import threading, time, thread, ThreadingEvent
42
48
  from _pydevd_bundle import pydevd_extension_utils, pydevd_frame_utils
43
49
  from _pydevd_bundle.pydevd_filtering import FilesFiltering, glob_matches_path
44
50
  from _pydevd_bundle import pydevd_io, pydevd_vm_type, pydevd_defaults
45
51
  from _pydevd_bundle import pydevd_utils
46
52
  from _pydevd_bundle import pydevd_runpy
47
53
  from _pydev_bundle.pydev_console_utils import DebugConsoleStdIn
48
- from _pydevd_bundle.pydevd_additional_thread_info import set_additional_thread_info
54
+ from _pydevd_bundle.pydevd_additional_thread_info import set_additional_thread_info, remove_additional_info
49
55
  from _pydevd_bundle.pydevd_breakpoints import ExceptionBreakpoint, get_exception_breakpoint
50
- from _pydevd_bundle.pydevd_comm_constants import (CMD_THREAD_SUSPEND, CMD_STEP_INTO, CMD_SET_BREAK,
51
- CMD_STEP_INTO_MY_CODE, CMD_STEP_OVER, CMD_SMART_STEP_INTO, CMD_RUN_TO_LINE,
52
- CMD_SET_NEXT_STATEMENT, CMD_STEP_RETURN, CMD_ADD_EXCEPTION_BREAK, CMD_STEP_RETURN_MY_CODE,
53
- CMD_STEP_OVER_MY_CODE, constant_to_str, CMD_STEP_INTO_COROUTINE)
54
- from _pydevd_bundle.pydevd_constants import (get_thread_id, get_current_thread_id,
55
- DebugInfoHolder, PYTHON_SUSPEND, STATE_SUSPEND, STATE_RUN, get_frame,
56
- clear_cached_thread_id, INTERACTIVE_MODE_AVAILABLE, SHOW_DEBUG_INFO_ENV, NULL,
57
- NO_FTRACE, IS_IRONPYTHON, JSON_PROTOCOL, IS_CPYTHON, HTTP_JSON_PROTOCOL, USE_CUSTOM_SYS_CURRENT_FRAMES_MAP, call_only_once,
58
- ForkSafeLock, IGNORE_BASENAMES_STARTING_WITH, EXCEPTION_TYPE_UNHANDLED, SUPPORT_GEVENT,
59
- PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING, PYDEVD_IPYTHON_CONTEXT)
56
+ from _pydevd_bundle.pydevd_comm_constants import (
57
+ CMD_THREAD_SUSPEND,
58
+ CMD_STEP_INTO,
59
+ CMD_SET_BREAK,
60
+ CMD_STEP_INTO_MY_CODE,
61
+ CMD_STEP_OVER,
62
+ CMD_SMART_STEP_INTO,
63
+ CMD_RUN_TO_LINE,
64
+ CMD_SET_NEXT_STATEMENT,
65
+ CMD_STEP_RETURN,
66
+ CMD_ADD_EXCEPTION_BREAK,
67
+ CMD_STEP_RETURN_MY_CODE,
68
+ CMD_STEP_OVER_MY_CODE,
69
+ constant_to_str,
70
+ CMD_STEP_INTO_COROUTINE,
71
+ )
72
+ from _pydevd_bundle.pydevd_constants import (
73
+ get_thread_id,
74
+ get_current_thread_id,
75
+ DebugInfoHolder,
76
+ PYTHON_SUSPEND,
77
+ STATE_SUSPEND,
78
+ STATE_RUN,
79
+ get_frame,
80
+ clear_cached_thread_id,
81
+ INTERACTIVE_MODE_AVAILABLE,
82
+ SHOW_DEBUG_INFO_ENV,
83
+ NULL,
84
+ NO_FTRACE,
85
+ IS_IRONPYTHON,
86
+ JSON_PROTOCOL,
87
+ IS_CPYTHON,
88
+ HTTP_JSON_PROTOCOL,
89
+ USE_CUSTOM_SYS_CURRENT_FRAMES_MAP,
90
+ call_only_once,
91
+ ForkSafeLock,
92
+ IGNORE_BASENAMES_STARTING_WITH,
93
+ EXCEPTION_TYPE_UNHANDLED,
94
+ SUPPORT_GEVENT,
95
+ PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING,
96
+ PYDEVD_IPYTHON_CONTEXT,
97
+ PYDEVD_USE_SYS_MONITORING,
98
+ )
60
99
  from _pydevd_bundle.pydevd_defaults import PydevdCustomization # Note: import alias used on pydev_monkey.
61
100
  from _pydevd_bundle.pydevd_custom_frames import CustomFramesContainer, custom_frames_container_init
62
101
  from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE, PYDEV_FILE, LIB_FILE, DONT_TRACE_DIRS
@@ -64,26 +103,46 @@ from _pydevd_bundle.pydevd_extension_api import DebuggerEventHandler
64
103
  from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, remove_exception_from_frame
65
104
  from _pydevd_bundle.pydevd_net_command_factory_xml import NetCommandFactory
66
105
  from _pydevd_bundle.pydevd_trace_dispatch import (
67
- trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips, fix_top_level_trace_and_get_trace_func, USING_CYTHON)
68
- from _pydevd_bundle.pydevd_utils import save_main_module, is_current_thread_main_thread, \
69
- import_attr_from_module
70
- from _pydevd_frame_eval.pydevd_frame_eval_main import (
71
- frame_eval_func, dummy_trace_dispatch, USING_FRAME_EVAL)
106
+ trace_dispatch as _trace_dispatch,
107
+ global_cache_skips,
108
+ global_cache_frame_skips,
109
+ fix_top_level_trace_and_get_trace_func,
110
+ USING_CYTHON,
111
+ )
112
+ from _pydevd_bundle.pydevd_utils import save_main_module, is_current_thread_main_thread, import_attr_from_module
113
+ from _pydevd_frame_eval.pydevd_frame_eval_main import frame_eval_func, dummy_trace_dispatch, USING_FRAME_EVAL
72
114
  import pydev_ipython # @UnusedImport
73
115
  from _pydevd_bundle.pydevd_source_mapping import SourceMapping
74
- from _pydevd_bundle.pydevd_concurrency_analyser.pydevd_concurrency_logger import ThreadingLogger, AsyncioLogger, send_concurrency_message, cur_time
116
+ from _pydevd_bundle.pydevd_concurrency_analyser.pydevd_concurrency_logger import (
117
+ ThreadingLogger,
118
+ AsyncioLogger,
119
+ send_concurrency_message,
120
+ cur_time,
121
+ )
75
122
  from _pydevd_bundle.pydevd_concurrency_analyser.pydevd_thread_wrappers import wrap_threads
76
- from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
123
+ from pydevd_file_utils import (
124
+ get_abs_path_real_path_and_base_from_frame,
125
+ get_abs_path_real_path_and_base_from_file,
126
+ NORM_PATHS_AND_BASE_CONTAINER,
127
+ )
77
128
  from pydevd_file_utils import get_fullname, get_package_dir
78
129
  from os.path import abspath as os_path_abspath
79
130
  import pydevd_tracing
80
- from _pydevd_bundle.pydevd_comm import (InternalThreadCommand, InternalThreadCommandForAnyThread,
81
- create_server_socket, FSNotifyThread)
82
- from _pydevd_bundle.pydevd_comm import(InternalConsoleExec,
83
- _queue, ReaderThread, GetGlobalDebugger, get_global_debugger,
84
- set_global_debugger, WriterThread,
85
- start_client, start_server, InternalGetBreakpointException, InternalSendCurrExceptionTrace,
86
- InternalSendCurrExceptionTraceProceeded)
131
+ from _pydevd_bundle.pydevd_comm import InternalThreadCommand, InternalThreadCommandForAnyThread, create_server_socket, FSNotifyThread
132
+ from _pydevd_bundle.pydevd_comm import (
133
+ InternalConsoleExec,
134
+ _queue,
135
+ ReaderThread,
136
+ GetGlobalDebugger,
137
+ get_global_debugger,
138
+ set_global_debugger,
139
+ WriterThread,
140
+ start_client,
141
+ start_server,
142
+ InternalGetBreakpointException,
143
+ InternalSendCurrExceptionTrace,
144
+ InternalSendCurrExceptionTraceProceeded,
145
+ )
87
146
  from _pydevd_bundle.pydevd_daemon_thread import PyDBDaemonThread, mark_as_pydevd_daemon_thread
88
147
  from _pydevd_bundle.pydevd_process_net_command_json import PyDevJsonCommandProcessor
89
148
  from _pydevd_bundle.pydevd_process_net_command import process_net_command
@@ -97,6 +156,9 @@ from _pydevd_bundle.pydevd_api import PyDevdAPI
97
156
  from _pydevd_bundle.pydevd_timeout import TimeoutTracker
98
157
  from _pydevd_bundle.pydevd_thread_lifecycle import suspend_all_threads, mark_thread_suspended
99
158
 
159
+ if PYDEVD_USE_SYS_MONITORING:
160
+ from _pydevd_sys_monitoring import pydevd_sys_monitoring
161
+
100
162
  pydevd_gevent_integration = None
101
163
 
102
164
  if SUPPORT_GEVENT:
@@ -104,20 +166,21 @@ if SUPPORT_GEVENT:
104
166
  from _pydevd_bundle import pydevd_gevent_integration
105
167
  except:
106
168
  pydev_log.exception(
107
- 'pydevd: GEVENT_SUPPORT is set but gevent is not available in the environment.\n'
108
- 'Please unset GEVENT_SUPPORT from the environment variables or install gevent.')
169
+ "pydevd: GEVENT_SUPPORT is set but gevent is not available in the environment.\n"
170
+ "Please unset GEVENT_SUPPORT from the environment variables or install gevent."
171
+ )
109
172
  else:
110
173
  pydevd_gevent_integration.log_gevent_debug_info()
111
174
 
112
175
  if USE_CUSTOM_SYS_CURRENT_FRAMES_MAP:
113
176
  from _pydevd_bundle.pydevd_constants import constructed_tid_to_last_frame
114
177
 
115
- __version_info__ = (2, 9, 5)
178
+ __version_info__ = (3, 1, 0)
116
179
  __version_info_str__ = []
117
180
  for v in __version_info__:
118
181
  __version_info_str__.append(str(v))
119
182
 
120
- __version__ = '.'.join(__version_info_str__)
183
+ __version__ = ".".join(__version_info_str__)
121
184
 
122
185
  # IMPORTANT: pydevd_constants must be the 1st thing defined because it'll keep a reference to the original sys._getframe
123
186
 
@@ -126,13 +189,13 @@ def install_breakpointhook(pydevd_breakpointhook=None):
126
189
  if pydevd_breakpointhook is None:
127
190
 
128
191
  def pydevd_breakpointhook(*args, **kwargs):
129
- hookname = os.getenv('PYTHONBREAKPOINT')
192
+ hookname = os.getenv("PYTHONBREAKPOINT")
130
193
  if (
131
- hookname is not None
132
- and len(hookname) > 0
133
- and hasattr(sys, '__breakpointhook__')
134
- and sys.__breakpointhook__ != pydevd_breakpointhook
135
- ):
194
+ hookname is not None
195
+ and len(hookname) > 0
196
+ and hasattr(sys, "__breakpointhook__")
197
+ and sys.__breakpointhook__ != pydevd_breakpointhook
198
+ ):
136
199
  sys.__breakpointhook__(*args, **kwargs)
137
200
  else:
138
201
  settrace(*args, **kwargs)
@@ -168,7 +231,7 @@ threadingEnumerate = threading.enumerate
168
231
  threadingCurrentThread = threading.current_thread
169
232
 
170
233
  try:
171
- 'dummy'.encode('utf-8') # Added because otherwise Jython 2.2.1 wasn't finding the encoding (if it wasn't loaded in the main thread).
234
+ "dummy".encode("utf-8") # Added because otherwise Jython 2.2.1 wasn't finding the encoding (if it wasn't loaded in the main thread).
172
235
  except:
173
236
  pass
174
237
 
@@ -179,28 +242,30 @@ file_system_encoding = getfilesystemencoding()
179
242
 
180
243
  _CACHE_FILE_TYPE = {}
181
244
 
182
- pydev_log.debug('Using GEVENT_SUPPORT: %s', pydevd_constants.SUPPORT_GEVENT)
183
- pydev_log.debug('Using GEVENT_SHOW_PAUSED_GREENLETS: %s', pydevd_constants.GEVENT_SHOW_PAUSED_GREENLETS)
184
- pydev_log.debug('pydevd __file__: %s', os.path.abspath(__file__))
185
- pydev_log.debug('Using PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING: %s', pydevd_constants.PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING)
245
+ pydev_log.debug("Using GEVENT_SUPPORT: %s", pydevd_constants.SUPPORT_GEVENT)
246
+ pydev_log.debug("Using GEVENT_SHOW_PAUSED_GREENLETS: %s", pydevd_constants.GEVENT_SHOW_PAUSED_GREENLETS)
247
+ pydev_log.debug("pydevd __file__: %s", os.path.abspath(__file__))
248
+ pydev_log.debug("Using PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING: %s", pydevd_constants.PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING)
186
249
  if pydevd_constants.PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING:
187
- pydev_log.debug('PYDEVD_IPYTHON_CONTEXT: %s', pydevd_constants.PYDEVD_IPYTHON_CONTEXT)
250
+ pydev_log.debug("PYDEVD_IPYTHON_CONTEXT: %s", pydevd_constants.PYDEVD_IPYTHON_CONTEXT)
251
+
252
+ TIMEOUT_SLOW = 0.2
253
+ TIMEOUT_FAST = 1.0 / 50
188
254
 
189
255
 
190
- #=======================================================================================================================
256
+ # =======================================================================================================================
191
257
  # PyDBCommandThread
192
- #=======================================================================================================================
258
+ # =======================================================================================================================
193
259
  class PyDBCommandThread(PyDBDaemonThread):
194
-
195
260
  def __init__(self, py_db):
196
261
  PyDBDaemonThread.__init__(self, py_db)
197
262
  self._py_db_command_thread_event = py_db._py_db_command_thread_event
198
- self.name = 'pydevd.CommandThread'
263
+ self.name = "pydevd.CommandThread"
199
264
 
200
265
  @overrides(PyDBDaemonThread._on_run)
201
266
  def _on_run(self):
202
267
  # Delay a bit this initialization to wait for the main program to start.
203
- self._py_db_command_thread_event.wait(0.3)
268
+ self._py_db_command_thread_event.wait(TIMEOUT_SLOW)
204
269
 
205
270
  if self._kill_received:
206
271
  return
@@ -208,11 +273,11 @@ class PyDBCommandThread(PyDBDaemonThread):
208
273
  try:
209
274
  while not self._kill_received:
210
275
  try:
211
- self.py_db.process_internal_commands()
276
+ self.py_db.process_internal_commands(("*",))
212
277
  except:
213
- pydev_log.info('Finishing debug communication...(2)')
278
+ pydev_log.info("Finishing debug communication...(2)")
214
279
  self._py_db_command_thread_event.clear()
215
- self._py_db_command_thread_event.wait(0.3)
280
+ self._py_db_command_thread_event.wait(TIMEOUT_SLOW)
216
281
  except:
217
282
  try:
218
283
  pydev_log.debug(sys.exc_info()[0])
@@ -231,17 +296,16 @@ class PyDBCommandThread(PyDBDaemonThread):
231
296
  self._py_db_command_thread_event.set()
232
297
 
233
298
 
234
- #=======================================================================================================================
299
+ # =======================================================================================================================
235
300
  # CheckAliveThread
236
301
  # Non-daemon thread: guarantees that all data is written even if program is finished
237
- #=======================================================================================================================
302
+ # =======================================================================================================================
238
303
  class CheckAliveThread(PyDBDaemonThread):
239
-
240
304
  def __init__(self, py_db):
241
305
  PyDBDaemonThread.__init__(self, py_db)
242
- self.name = 'pydevd.CheckAliveThread'
306
+ self.name = "pydevd.CheckAliveThread"
243
307
  self.daemon = False
244
- self._wait_event = threading.Event()
308
+ self._wait_event = ThreadingEvent()
245
309
 
246
310
  @overrides(PyDBDaemonThread._on_run)
247
311
  def _on_run(self):
@@ -258,7 +322,7 @@ class CheckAliveThread(PyDBDaemonThread):
258
322
 
259
323
  try:
260
324
  while not self._kill_received:
261
- self._wait_event.wait(0.3)
325
+ self._wait_event.wait(TIMEOUT_SLOW)
262
326
  if can_exit():
263
327
  break
264
328
 
@@ -284,7 +348,7 @@ class CheckAliveThread(PyDBDaemonThread):
284
348
 
285
349
 
286
350
  class AbstractSingleNotificationBehavior(object):
287
- '''
351
+ """
288
352
  The basic usage should be:
289
353
 
290
354
  # Increment the request time for the suspend.
@@ -300,20 +364,20 @@ class AbstractSingleNotificationBehavior(object):
300
364
  def do_wait_suspend(...):
301
365
  with single_notification_behavior.notify_thread_suspended(thread_id, thread, reason):
302
366
  ...
303
- '''
367
+ """
304
368
 
305
369
  __slots__ = [
306
- '_last_resume_notification_time',
307
- '_last_suspend_notification_time',
308
- '_lock',
309
- '_next_request_time',
310
- '_suspend_time_request',
311
- '_suspended_thread_id_to_thread',
312
- '_pause_requested',
313
- '_py_db',
370
+ "_last_resume_notification_time",
371
+ "_last_suspend_notification_time",
372
+ "_lock",
373
+ "_next_request_time",
374
+ "_suspend_time_request",
375
+ "_suspended_thread_id_to_thread",
376
+ "_pause_requested",
377
+ "_py_db",
314
378
  ]
315
379
 
316
- NOTIFY_OF_PAUSE_TIMEOUT = .5
380
+ NOTIFY_OF_PAUSE_TIMEOUT = 0.5
317
381
 
318
382
  def __init__(self, py_db):
319
383
  self._py_db = weakref.ref(py_db)
@@ -326,10 +390,10 @@ class AbstractSingleNotificationBehavior(object):
326
390
  self._pause_requested = False
327
391
 
328
392
  def send_suspend_notification(self, thread_id, thread, stop_reason):
329
- raise AssertionError('abstract: subclasses must override.')
393
+ raise AssertionError("abstract: subclasses must override.")
330
394
 
331
395
  def send_resume_notification(self, thread_id):
332
- raise AssertionError('abstract: subclasses must override.')
396
+ raise AssertionError("abstract: subclasses must override.")
333
397
 
334
398
  def increment_suspend_time(self):
335
399
  with self._lock:
@@ -344,9 +408,7 @@ class AbstractSingleNotificationBehavior(object):
344
408
  py_db = self._py_db()
345
409
  if py_db is not None:
346
410
  py_db.timeout_tracker.call_on_timeout(
347
- self.NOTIFY_OF_PAUSE_TIMEOUT,
348
- self._notify_after_timeout,
349
- kwargs={'global_suspend_time': global_suspend_time}
411
+ self.NOTIFY_OF_PAUSE_TIMEOUT, self._notify_after_timeout, kwargs={"global_suspend_time": global_suspend_time}
350
412
  )
351
413
 
352
414
  def _notify_after_timeout(self, global_suspend_time):
@@ -355,7 +417,7 @@ class AbstractSingleNotificationBehavior(object):
355
417
  if global_suspend_time > self._last_suspend_notification_time:
356
418
  self._last_suspend_notification_time = global_suspend_time
357
419
  # Notify about any thread which is currently suspended.
358
- pydev_log.info('Sending suspend notification after timeout.')
420
+ pydev_log.info("Sending suspend notification after timeout.")
359
421
  thread_id, thread = next(iter(self._suspended_thread_id_to_thread.items()))
360
422
  self.send_suspend_notification(thread_id, thread, CMD_THREAD_SUSPEND)
361
423
 
@@ -372,18 +434,18 @@ class AbstractSingleNotificationBehavior(object):
372
434
  # issue for a CMD_THREAD_SUSPEND if a pause is pending.
373
435
  if stop_reason != CMD_THREAD_SUSPEND or pause_requested:
374
436
  if self._suspend_time_request > self._last_suspend_notification_time:
375
- pydev_log.info('Sending suspend notification.')
437
+ pydev_log.info("Sending suspend notification.")
376
438
  self._last_suspend_notification_time = self._suspend_time_request
377
439
  self.send_suspend_notification(thread_id, thread, stop_reason)
378
440
  else:
379
441
  pydev_log.info(
380
- 'Suspend not sent (it was already sent). Last suspend % <= Last resume %s',
442
+ "Suspend not sent (it was already sent). Last suspend % <= Last resume %s",
381
443
  self._last_suspend_notification_time,
382
444
  self._last_resume_notification_time,
383
445
  )
384
446
  else:
385
447
  pydev_log.info(
386
- 'Suspend not sent because stop reason is thread suspend and pause was not requested.',
448
+ "Suspend not sent because stop reason is thread suspend and pause was not requested.",
387
449
  )
388
450
 
389
451
  def on_thread_resume(self, thread_id, thread):
@@ -391,12 +453,12 @@ class AbstractSingleNotificationBehavior(object):
391
453
  with self._lock:
392
454
  self._suspended_thread_id_to_thread.pop(thread_id)
393
455
  if self._last_resume_notification_time < self._last_suspend_notification_time:
394
- pydev_log.info('Sending resume notification.')
456
+ pydev_log.info("Sending resume notification.")
395
457
  self._last_resume_notification_time = self._last_suspend_notification_time
396
458
  self.send_resume_notification(thread_id)
397
459
  else:
398
460
  pydev_log.info(
399
- 'Resume not sent (it was already sent). Last resume %s >= Last suspend %s',
461
+ "Resume not sent (it was already sent). Last resume %s >= Last suspend %s",
400
462
  self._last_resume_notification_time,
401
463
  self._last_suspend_notification_time,
402
464
  )
@@ -411,9 +473,7 @@ class AbstractSingleNotificationBehavior(object):
411
473
 
412
474
 
413
475
  class ThreadsSuspendedSingleNotification(AbstractSingleNotificationBehavior):
414
-
415
- __slots__ = AbstractSingleNotificationBehavior.__slots__ + [
416
- 'multi_threads_single_notification', '_callbacks', '_callbacks_lock']
476
+ __slots__ = AbstractSingleNotificationBehavior.__slots__ + ["multi_threads_single_notification", "_callbacks", "_callbacks_lock"]
417
477
 
418
478
  def __init__(self, py_db):
419
479
  AbstractSingleNotificationBehavior.__init__(self, py_db)
@@ -443,23 +503,22 @@ class ThreadsSuspendedSingleNotification(AbstractSingleNotificationBehavior):
443
503
  def send_suspend_notification(self, thread_id, thread, stop_reason):
444
504
  py_db = self._py_db()
445
505
  if py_db is not None:
446
- py_db.writer.add_command(
447
- py_db.cmd_factory.make_thread_suspend_single_notification(
448
- py_db, thread_id, thread, stop_reason))
506
+ py_db.writer.add_command(py_db.cmd_factory.make_thread_suspend_single_notification(py_db, thread_id, thread, stop_reason))
449
507
 
450
508
  @overrides(AbstractSingleNotificationBehavior.notify_thread_suspended)
451
509
  @contextmanager
452
510
  def notify_thread_suspended(self, thread_id, thread, stop_reason):
453
511
  if self.multi_threads_single_notification:
512
+ pydev_log.info("Thread suspend mode: single notification")
454
513
  with AbstractSingleNotificationBehavior.notify_thread_suspended(self, thread_id, thread, stop_reason):
455
514
  yield
456
515
  else:
516
+ pydev_log.info("Thread suspend mode: NOT single notification")
457
517
  yield
458
518
 
459
519
 
460
520
  class _Authentication(object):
461
-
462
- __slots__ = ['access_token', 'client_access_token', '_authenticated', '_wrong_attempts']
521
+ __slots__ = ["access_token", "client_access_token", "_authenticated", "_wrong_attempts"]
463
522
 
464
523
  def __init__(self):
465
524
  # A token to be send in the command line or through the settrace api -- when such token
@@ -497,7 +556,7 @@ class _Authentication(object):
497
556
 
498
557
 
499
558
  class PyDB(object):
500
- """ Main debugging class
559
+ """Main debugging class
501
560
  Lots of stuff going on here:
502
561
 
503
562
  PyDB starts two threads on startup that connect to remote debugger (RDB)
@@ -525,12 +584,13 @@ class PyDB(object):
525
584
  self._fsnotify_thread = None
526
585
  self.created_pydb_daemon_threads = {}
527
586
  self._waiting_for_connection_thread = None
528
- self._on_configuration_done_event = threading.Event()
587
+ self._on_configuration_done_event = ThreadingEvent()
529
588
  self.check_alive_thread = None
530
589
  self.py_db_command_thread = None
531
590
  self.quitting = None
532
591
  self.cmd_factory = NetCommandFactory()
533
592
  self._cmd_queue = defaultdict(_queue.Queue) # Key is thread id or '*', value is Queue
593
+ self._thread_events = defaultdict(ThreadingEvent) # Key is thread id or '*', value is Event
534
594
  self.suspended_frames_manager = SuspendedFramesManager()
535
595
  self._files_filtering = FilesFiltering()
536
596
  self.timeout_tracker = TimeoutTracker(self)
@@ -538,7 +598,7 @@ class PyDB(object):
538
598
  # Note: when the source mapping is changed we also have to clear the file types cache
539
599
  # (because if a given file is a part of the project or not may depend on it being
540
600
  # defined in the source mapping).
541
- self.source_mapping = SourceMapping(on_source_mapping_changed=self._clear_filters_caches)
601
+ self.source_mapping = SourceMapping(on_source_mapping_changed=self._clear_caches)
542
602
 
543
603
  # Determines whether we should terminate child processes when asked to terminate.
544
604
  self.terminate_child_processes = True
@@ -563,7 +623,8 @@ class PyDB(object):
563
623
 
564
624
  self.variable_presentation = PyDevdAPI.VariablePresentation()
565
625
 
566
- # mtime to be raised when breakpoints change
626
+ # mtime to be raised when something that will affect the
627
+ # tracing in place (such as breakpoints change or filtering).
567
628
  self.mtime = 0
568
629
 
569
630
  self.file_to_id_to_line_breakpoint = {}
@@ -579,14 +640,14 @@ class PyDB(object):
579
640
  self._main_lock = thread.allocate_lock()
580
641
  self._lock_running_thread_ids = thread.allocate_lock()
581
642
  self._lock_create_fs_notify = thread.allocate_lock()
582
- self._py_db_command_thread_event = threading.Event()
643
+ self._py_db_command_thread_event = ThreadingEvent()
583
644
  if set_as_global:
584
645
  CustomFramesContainer._py_db_command_thread_event = self._py_db_command_thread_event
585
646
 
586
647
  self.pydb_disposed = False
587
648
  self._wait_for_threads_to_finish_called = False
588
649
  self._wait_for_threads_to_finish_called_lock = thread.allocate_lock()
589
- self._wait_for_threads_to_finish_called_event = threading.Event()
650
+ self._wait_for_threads_to_finish_called_event = ThreadingEvent()
590
651
 
591
652
  self.terminate_requested = False
592
653
  self._disposed_lock = thread.allocate_lock()
@@ -631,7 +692,7 @@ class PyDB(object):
631
692
  # matplotlib - Whatever GUI backend matplotlib is using.
632
693
  # 'wx'/'qt'/'none'/... - GUI toolkits that have bulitin support. See pydevd_ipython/inputhook.py:24.
633
694
  # Other - A custom function that'll be imported and run.
634
- self._gui_event_loop = 'matplotlib'
695
+ self._gui_event_loop = "matplotlib"
635
696
  self._installed_gui_support = False
636
697
  self.gui_in_use = False
637
698
 
@@ -665,14 +726,13 @@ class PyDB(object):
665
726
 
666
727
  self._local_thread_trace_func = threading.local()
667
728
 
668
- self._server_socket_ready_event = threading.Event()
729
+ self._server_socket_ready_event = ThreadingEvent()
669
730
  self._server_socket_name = None
670
731
 
671
732
  # Bind many locals to the debugger because upon teardown those names may become None
672
733
  # in the namespace (and thus can't be relied upon unless the reference was previously
673
734
  # saved).
674
735
  if IS_IRONPYTHON:
675
-
676
736
  # A partial() cannot be used in IronPython for sys.settrace.
677
737
  def new_trace_dispatch(frame, event, arg):
678
738
  return _trace_dispatch(self, frame, event, arg)
@@ -726,14 +786,13 @@ class PyDB(object):
726
786
  filename = code_obj.co_filename
727
787
  try:
728
788
  if os.path.exists(filename):
729
- pydev_log.debug('Collecting try..except info from source for %s', filename)
789
+ pydev_log.debug("Collecting try..except info from source for %s", filename)
730
790
  try_except_infos = collect_try_except_info_from_source(filename)
731
791
  if try_except_infos:
732
792
  # Filter for the current function
733
793
  max_line = -1
734
794
  min_line = sys.maxsize
735
795
  for _, line in dis.findlinestarts(code_obj):
736
-
737
796
  if line > max_line:
738
797
  max_line = line
739
798
 
@@ -744,15 +803,14 @@ class PyDB(object):
744
803
  return try_except_infos
745
804
 
746
805
  except:
747
- pydev_log.exception('Error collecting try..except info from source (%s)', filename)
806
+ pydev_log.exception("Error collecting try..except info from source (%s)", filename)
748
807
 
749
- pydev_log.debug('Collecting try..except info from bytecode for %s', filename)
808
+ pydev_log.debug("Collecting try..except info from bytecode for %s", filename)
750
809
  return collect_try_except_info(code_obj)
751
810
 
752
811
  def setup_auto_reload_watcher(self, enable_auto_reload, watch_dirs, poll_target_time, exclude_patterns, include_patterns):
753
812
  try:
754
813
  with self._lock_create_fs_notify:
755
-
756
814
  # When setting up, dispose of the previous one (if any).
757
815
  if self._fsnotify_thread is not None:
758
816
  self._fsnotify_thread.do_kill_pydev_thread()
@@ -768,7 +826,7 @@ class PyDB(object):
768
826
  try:
769
827
  return cache[absolute_filename]
770
828
  except:
771
- if absolute_filename and absolute_filename[-1] not in ('/', '\\'):
829
+ if absolute_filename and absolute_filename[-1] not in ("/", "\\"):
772
830
  # I.e.: for directories we always end with '/' or '\\' so that
773
831
  # we match exclusions such as "**/node_modules/**"
774
832
  absolute_filename += os.path.sep
@@ -818,15 +876,15 @@ class PyDB(object):
818
876
  watcher.target_time_for_notification = poll_target_time
819
877
  self._fsnotify_thread.start()
820
878
  except:
821
- pydev_log.exception('Error setting up auto-reload.')
879
+ pydev_log.exception("Error setting up auto-reload.")
822
880
 
823
881
  def get_arg_ppid(self):
824
882
  try:
825
883
  setup = SetupHolder.setup
826
884
  if setup:
827
- return int(setup.get('ppid', 0))
885
+ return int(setup.get("ppid", 0))
828
886
  except:
829
- pydev_log.exception('Error getting ppid.')
887
+ pydev_log.exception("Error getting ppid.")
830
888
 
831
889
  return 0
832
890
 
@@ -835,18 +893,18 @@ class PyDB(object):
835
893
  # busy wait until we receive run command
836
894
  self.process_internal_commands()
837
895
  self._py_db_command_thread_event.clear()
838
- self._py_db_command_thread_event.wait(0.1)
896
+ self._py_db_command_thread_event.wait(TIMEOUT_FAST)
839
897
 
840
898
  def on_initialize(self):
841
- '''
899
+ """
842
900
  Note: only called when using the DAP (Debug Adapter Protocol).
843
- '''
901
+ """
844
902
  self._on_configuration_done_event.clear()
845
903
 
846
904
  def on_configuration_done(self):
847
- '''
905
+ """
848
906
  Note: only called when using the DAP (Debug Adapter Protocol).
849
- '''
907
+ """
850
908
  self._on_configuration_done_event.set()
851
909
  self._py_db_command_thread_event.set()
852
910
 
@@ -854,9 +912,9 @@ class PyDB(object):
854
912
  return self._on_configuration_done_event.is_set()
855
913
 
856
914
  def on_disconnect(self):
857
- '''
915
+ """
858
916
  Note: only called when using the DAP (Debug Adapter Protocol).
859
- '''
917
+ """
860
918
  self.authentication.logout()
861
919
  self._on_configuration_done_event.clear()
862
920
 
@@ -865,7 +923,7 @@ class PyDB(object):
865
923
  self._ignore_system_exit_codes = set(ignore_system_exit_codes)
866
924
 
867
925
  def ignore_system_exit_code(self, system_exit_exc):
868
- if hasattr(system_exit_exc, 'code'):
926
+ if hasattr(system_exit_exc, "code"):
869
927
  return system_exit_exc.code in self._ignore_system_exit_codes
870
928
  else:
871
929
  return system_exit_exc in self._ignore_system_exit_codes
@@ -881,7 +939,7 @@ class PyDB(object):
881
939
 
882
940
  self.process_internal_commands()
883
941
  self._py_db_command_thread_event.clear()
884
- self._py_db_command_thread_event.wait(1 / 15.)
942
+ self._py_db_command_thread_event.wait(TIMEOUT_FAST)
885
943
 
886
944
  def add_fake_frame(self, thread_id, frame_id, frame):
887
945
  self.suspended_frames_manager.add_fake_frame(thread_id, frame_id, frame)
@@ -902,8 +960,7 @@ class PyDB(object):
902
960
  etype, value, tb = sys.exc_info()
903
961
  traceback.print_exception(etype, value, tb.tb_next, file=stack_trace)
904
962
 
905
- msg = 'Error while evaluating expression in conditional breakpoint: %s\n%s' % (
906
- condition, stack_trace.getvalue())
963
+ msg = "Error while evaluating expression in conditional breakpoint: %s\n%s" % (condition, stack_trace.getvalue())
907
964
  api = PyDevdAPI()
908
965
  api.send_error_message(self, msg)
909
966
 
@@ -911,13 +968,12 @@ class PyDB(object):
911
968
  try:
912
969
  # add exception_type and stacktrace into thread additional info
913
970
  etype, value, tb = sys.exc_info()
914
- error = ''.join(traceback.format_exception_only(etype, value))
971
+ error = "".join(traceback.format_exception_only(etype, value))
915
972
  stack = traceback.extract_stack(f=tb.tb_frame.f_back)
916
973
 
917
974
  # On self.set_suspend(thread, CMD_SET_BREAK) this info will be
918
975
  # sent to the client.
919
- info.conditional_breakpoint_exception = \
920
- ('Condition:\n' + condition + '\n\nError:\n' + error, stack)
976
+ info.conditional_breakpoint_exception = ("Condition:\n" + condition + "\n\nError:\n" + error, stack)
921
977
  except:
922
978
  pydev_log.exception()
923
979
  return True
@@ -939,10 +995,7 @@ class PyDB(object):
939
995
 
940
996
  def _internal_get_file_type(self, abs_real_path_and_basename):
941
997
  basename = abs_real_path_and_basename[-1]
942
- if (
943
- basename.startswith(IGNORE_BASENAMES_STARTING_WITH) or
944
- abs_real_path_and_basename[0].startswith(IGNORE_BASENAMES_STARTING_WITH)
945
- ):
998
+ if basename.startswith(IGNORE_BASENAMES_STARTING_WITH) or abs_real_path_and_basename[0].startswith(IGNORE_BASENAMES_STARTING_WITH):
946
999
  # Note: these are the files that are completely ignored (they aren't shown to the user
947
1000
  # as user nor library code as it's usually just noise in the frame stack).
948
1001
  return self.PYDEV_FILE
@@ -950,16 +1003,16 @@ class PyDB(object):
950
1003
  if file_type is not None:
951
1004
  return file_type
952
1005
 
953
- if basename.startswith('__init__.py'):
1006
+ if basename.startswith("__init__.py") or basename in LIB_FILES_IN_DONT_TRACE_DIRS:
954
1007
  # i.e.: ignore the __init__ files inside pydevd (the other
955
1008
  # files are ignored just by their name).
956
1009
  abs_path = abs_real_path_and_basename[0]
957
- i = max(abs_path.rfind('/'), abs_path.rfind('\\'))
1010
+ i = max(abs_path.rfind("/"), abs_path.rfind("\\"))
958
1011
  if i:
959
1012
  abs_path = abs_path[0:i]
960
- i = max(abs_path.rfind('/'), abs_path.rfind('\\'))
1013
+ i = max(abs_path.rfind("/"), abs_path.rfind("\\"))
961
1014
  if i:
962
- dirname = abs_path[i + 1:]
1015
+ dirname = abs_path[i + 1 :]
963
1016
  # At this point, something as:
964
1017
  # "my_path\_pydev_runfiles\__init__.py"
965
1018
  # is now "_pydev_runfiles".
@@ -967,7 +1020,7 @@ class PyDB(object):
967
1020
  return None
968
1021
 
969
1022
  def dont_trace_external_files(self, abs_path):
970
- '''
1023
+ """
971
1024
  :param abs_path:
972
1025
  The result from get_abs_path_real_path_and_base_from_file or
973
1026
  get_abs_path_real_path_and_base_from_frame.
@@ -978,13 +1031,13 @@ class PyDB(object):
978
1031
 
979
1032
  False:
980
1033
  If files should be traced.
981
- '''
1034
+ """
982
1035
  # By default all external files are traced. Note: this function is expected to
983
1036
  # be changed for another function in PyDevdAPI.set_dont_trace_start_end_patterns.
984
1037
  return False
985
1038
 
986
1039
  def get_file_type(self, frame, abs_real_path_and_basename=None, _cache_file_type=_CACHE_FILE_TYPE):
987
- '''
1040
+ """
988
1041
  :param abs_real_path_and_basename:
989
1042
  The result from get_abs_path_real_path_and_base_from_file or
990
1043
  get_abs_path_real_path_and_base_from_frame.
@@ -999,7 +1052,7 @@ class PyDB(object):
999
1052
 
1000
1053
  None:
1001
1054
  If it's a regular user file which should be traced.
1002
- '''
1055
+ """
1003
1056
  if abs_real_path_and_basename is None:
1004
1057
  try:
1005
1058
  # Make fast path faster!
@@ -1021,14 +1074,26 @@ class PyDB(object):
1021
1074
  try:
1022
1075
  return _cache_file_type[cache_key]
1023
1076
  except:
1024
- if abs_real_path_and_basename[0] == '<string>':
1025
-
1077
+ if abs_real_path_and_basename[0] == "<string>":
1026
1078
  # Consider it an untraceable file unless there's no back frame (ignoring
1027
1079
  # internal files and runpy.py).
1080
+ if frame.f_back is None:
1081
+ _cache_file_type[cache_key] = None
1082
+ return None
1083
+
1084
+ back_basename = pydevd_file_utils.basename(frame.f_back.f_code.co_filename)
1085
+ if "sys_monitoring" in back_basename or "pydevd" in back_basename:
1086
+ # Special case, this is a string coming from pydevd itself
1087
+ _cache_file_type[cache_key] = PYDEV_FILE
1088
+ return PYDEV_FILE
1089
+
1028
1090
  f = frame.f_back
1091
+ back_frames = ""
1029
1092
  while f is not None:
1030
- if (self.get_file_type(f) != self.PYDEV_FILE and
1031
- pydevd_file_utils.basename(f.f_code.co_filename) not in ('runpy.py', '<string>')):
1093
+ if self.get_file_type(f) != self.PYDEV_FILE and pydevd_file_utils.basename(f.f_code.co_filename) not in (
1094
+ "runpy.py",
1095
+ "<string>",
1096
+ ):
1032
1097
  # We found some back frame that's not internal, which means we must consider
1033
1098
  # this a library file.
1034
1099
  # This is done because we only want to trace files as <string> if they don't
@@ -1040,6 +1105,8 @@ class PyDB(object):
1040
1105
  # to show it in the stack.
1041
1106
  _cache_file_type[cache_key] = LIB_FILE
1042
1107
  return LIB_FILE
1108
+
1109
+ back_frames += " -> %s" % (pydevd_file_utils.basename(f.f_code.co_filename))
1043
1110
  f = f.f_back
1044
1111
  else:
1045
1112
  # This is a top-level file (used in python -c), so, trace it as usual... we
@@ -1069,7 +1136,7 @@ class PyDB(object):
1069
1136
  return thread_trace_func
1070
1137
 
1071
1138
  def enable_tracing(self, thread_trace_func=None, apply_to_all_threads=False):
1072
- '''
1139
+ """
1073
1140
  Enables tracing.
1074
1141
 
1075
1142
  If in regular mode (tracing), will set the tracing function to the tracing
@@ -1083,7 +1150,11 @@ class PyDB(object):
1083
1150
  In general apply_to_all_threads should only be true if this is the first time
1084
1151
  this function is called on a multi-threaded program (either programmatically or attach
1085
1152
  to pid).
1086
- '''
1153
+ """
1154
+ if PYDEVD_USE_SYS_MONITORING:
1155
+ pydevd_sys_monitoring.start_monitoring(all_threads=apply_to_all_threads)
1156
+ return
1157
+
1087
1158
  if pydevd_gevent_integration is not None:
1088
1159
  pydevd_gevent_integration.enable_gevent_integration()
1089
1160
 
@@ -1109,12 +1180,15 @@ class PyDB(object):
1109
1180
  pydevd_tracing.set_trace_to_threads(thread_trace_func)
1110
1181
 
1111
1182
  def disable_tracing(self):
1112
- pydevd_tracing.SetTrace(None)
1183
+ if PYDEVD_USE_SYS_MONITORING:
1184
+ pydevd_sys_monitoring.stop_monitoring(all_threads=False)
1185
+ else:
1186
+ pydevd_tracing.SetTrace(None)
1113
1187
 
1114
1188
  def on_breakpoints_changed(self, removed=False):
1115
- '''
1189
+ """
1116
1190
  When breakpoints change, we have to re-evaluate all the assumptions we've made so far.
1117
- '''
1191
+ """
1118
1192
  if not self.ready_to_run:
1119
1193
  # No need to do anything if we're still not running.
1120
1194
  return
@@ -1123,11 +1197,18 @@ class PyDB(object):
1123
1197
  if not removed:
1124
1198
  # When removing breakpoints we can leave tracing as was, but if a breakpoint was added
1125
1199
  # we have to reset the tracing for the existing functions to be re-evaluated.
1126
- self.set_tracing_for_untraced_contexts()
1127
1200
 
1128
- def set_tracing_for_untraced_contexts(self):
1201
+ # The caches also need to be cleared because of django breakpoints use case,
1202
+ # where adding a file needs to start tracking a context which was previously
1203
+ # untracked.
1204
+ self._clear_caches()
1205
+ self.set_tracing_for_untraced_contexts(breakpoints_changed=True)
1206
+
1207
+ def set_tracing_for_untraced_contexts(self, breakpoints_changed=False):
1129
1208
  # Enable the tracing for existing threads (because there may be frames being executed that
1130
1209
  # are currently untraced).
1210
+ if PYDEVD_USE_SYS_MONITORING and breakpoints_changed:
1211
+ pydevd_sys_monitoring.update_monitor_events()
1131
1212
 
1132
1213
  if IS_CPYTHON:
1133
1214
  # Note: use sys._current_frames instead of threading.enumerate() because this way
@@ -1135,26 +1216,27 @@ class PyDB(object):
1135
1216
  tid_to_frame = sys._current_frames()
1136
1217
 
1137
1218
  ignore_thread_ids = set(
1138
- t.ident for t in threadingEnumerate()
1139
- if getattr(t, 'is_pydev_daemon_thread', False) or getattr(t, 'pydev_do_not_trace', False)
1219
+ t.ident
1220
+ for t in threadingEnumerate()
1221
+ if getattr(t, "is_pydev_daemon_thread", False) or getattr(t, "pydev_do_not_trace", False)
1140
1222
  )
1141
1223
 
1142
- for thread_id, frame in tid_to_frame.items():
1143
- if thread_id not in ignore_thread_ids:
1144
- self.set_trace_for_frame_and_parents(frame)
1224
+ for thread_ident, frame in tid_to_frame.items():
1225
+ if thread_ident not in ignore_thread_ids:
1226
+ self.set_trace_for_frame_and_parents(thread_ident, frame)
1145
1227
 
1146
1228
  else:
1147
1229
  try:
1148
1230
  threads = threadingEnumerate()
1149
1231
  for t in threads:
1150
- if getattr(t, 'is_pydev_daemon_thread', False) or getattr(t, 'pydev_do_not_trace', False):
1232
+ if getattr(t, "is_pydev_daemon_thread", False) or getattr(t, "pydev_do_not_trace", False):
1151
1233
  continue
1152
1234
 
1153
1235
  additional_info = set_additional_thread_info(t)
1154
1236
  frame = additional_info.get_topmost_frame(t)
1155
1237
  try:
1156
1238
  if frame is not None:
1157
- self.set_trace_for_frame_and_parents(frame)
1239
+ self.set_trace_for_frame_and_parents(t.ident, frame)
1158
1240
  finally:
1159
1241
  frame = None
1160
1242
  finally:
@@ -1163,6 +1245,9 @@ class PyDB(object):
1163
1245
  threads = None
1164
1246
  additional_info = None
1165
1247
 
1248
+ if PYDEVD_USE_SYS_MONITORING:
1249
+ pydevd_sys_monitoring.restart_events()
1250
+
1166
1251
  @property
1167
1252
  def multi_threads_single_notification(self):
1168
1253
  return self._threads_suspended_single_notification.multi_threads_single_notification
@@ -1181,7 +1266,7 @@ class PyDB(object):
1181
1266
  return self.plugin
1182
1267
 
1183
1268
  def in_project_scope(self, frame, absolute_filename=None):
1184
- '''
1269
+ """
1185
1270
  Note: in general this method should not be used (apply_files_filter should be used
1186
1271
  in most cases as it also handles the project scope check).
1187
1272
 
@@ -1192,7 +1277,7 @@ class PyDB(object):
1192
1277
  Must be the result from get_abs_path_real_path_and_base_from_frame(frame)[0] (can
1193
1278
  be used to speed this function a bit if it's already available to the caller, but
1194
1279
  in general it's not needed).
1195
- '''
1280
+ """
1196
1281
  try:
1197
1282
  if absolute_filename is None:
1198
1283
  try:
@@ -1218,7 +1303,7 @@ class PyDB(object):
1218
1303
  if file_type == self.PYDEV_FILE:
1219
1304
  cache[cache_key] = False
1220
1305
 
1221
- elif absolute_filename == '<string>':
1306
+ elif absolute_filename == "<string>":
1222
1307
  # Special handling for '<string>'
1223
1308
  if file_type == self.LIB_FILE:
1224
1309
  cache[cache_key] = False
@@ -1236,7 +1321,12 @@ class PyDB(object):
1236
1321
  def in_project_roots_filename_uncached(self, absolute_filename):
1237
1322
  return self._files_filtering.in_project_roots(absolute_filename)
1238
1323
 
1239
- def _clear_filters_caches(self):
1324
+ def _clear_caches(self):
1325
+ # Skip caches
1326
+ global_cache_skips.clear()
1327
+ global_cache_frame_skips.clear()
1328
+
1329
+ # Filter caches
1240
1330
  self._in_project_scope_cache.clear()
1241
1331
  self._exclude_by_filter_cache.clear()
1242
1332
  self._apply_filter_cache.clear()
@@ -1244,22 +1334,26 @@ class PyDB(object):
1244
1334
  self._is_libraries_filter_enabled = self._files_filtering.use_libraries_filter()
1245
1335
  self.is_files_filter_enabled = self._exclude_filters_enabled or self._is_libraries_filter_enabled
1246
1336
 
1337
+ self.mtime += 1
1338
+ if PYDEVD_USE_SYS_MONITORING:
1339
+ pydevd_sys_monitoring.update_monitor_events()
1340
+ pydevd_sys_monitoring.restart_events()
1341
+
1247
1342
  def clear_dont_trace_start_end_patterns_caches(self):
1248
1343
  # When start/end patterns are changed we must clear all caches which would be
1249
1344
  # affected by a change in get_file_type() and reset the tracing function
1250
1345
  # as places which were traced may no longer need to be traced and vice-versa.
1251
1346
  self.on_breakpoints_changed()
1252
1347
  _CACHE_FILE_TYPE.clear()
1253
- self._clear_filters_caches()
1254
- self._clear_skip_caches()
1348
+ self._clear_caches()
1255
1349
 
1256
1350
  def _exclude_by_filter(self, frame, absolute_filename):
1257
- '''
1351
+ """
1258
1352
  :return: True if it should be excluded, False if it should be included and None
1259
1353
  if no rule matched the given file.
1260
1354
 
1261
1355
  :note: it'll be normalized as needed inside of this method.
1262
- '''
1356
+ """
1263
1357
  cache_key = (absolute_filename, frame.f_code.co_name, frame.f_code.co_firstlineno)
1264
1358
  try:
1265
1359
  return self._exclude_by_filter_cache[cache_key]
@@ -1272,13 +1366,13 @@ class PyDB(object):
1272
1366
  else:
1273
1367
  module_name = None
1274
1368
  if self._files_filtering.require_module:
1275
- module_name = frame.f_globals.get('__name__', '')
1369
+ module_name = frame.f_globals.get("__name__", "")
1276
1370
  cache[cache_key] = self._files_filtering.exclude_by_filter(absolute_filename, module_name)
1277
1371
 
1278
1372
  return cache[cache_key]
1279
1373
 
1280
1374
  def apply_files_filter(self, frame, original_filename, force_check_project_scope):
1281
- '''
1375
+ """
1282
1376
  Should only be called if `self.is_files_filter_enabled == True` or `force_check_project_scope == True`.
1283
1377
 
1284
1378
  Note that it covers both the filter by specific paths includes/excludes as well
@@ -1294,15 +1388,17 @@ class PyDB(object):
1294
1388
  :return bool:
1295
1389
  True if it should be excluded when stepping and False if it should be
1296
1390
  included.
1297
- '''
1391
+ """
1298
1392
  cache_key = (frame.f_code.co_firstlineno, original_filename, force_check_project_scope, frame.f_code)
1299
1393
  try:
1300
1394
  return self._apply_filter_cache[cache_key]
1301
1395
  except KeyError:
1396
+ DEBUG = True # 'defaulttags' in original_filename
1302
1397
  if self.plugin is not None and (self.has_plugin_line_breaks or self.has_plugin_exception_breaks):
1303
1398
  # If it's explicitly needed by some plugin, we can't skip it.
1304
1399
  if not self.plugin.can_skip(self, frame):
1305
- pydev_log.debug_once('File traced (included by plugins): %s', original_filename)
1400
+ if DEBUG:
1401
+ pydev_log.debug_once("File traced (included by plugins): %s", original_filename)
1306
1402
  self._apply_filter_cache[cache_key] = False
1307
1403
  return False
1308
1404
 
@@ -1312,12 +1408,14 @@ class PyDB(object):
1312
1408
  if exclude_by_filter is not None:
1313
1409
  if exclude_by_filter:
1314
1410
  # ignore files matching stepping filters
1315
- pydev_log.debug_once('File not traced (excluded by filters): %s', original_filename)
1411
+ if DEBUG:
1412
+ pydev_log.debug_once("File not traced (excluded by filters): %s", original_filename)
1316
1413
 
1317
1414
  self._apply_filter_cache[cache_key] = True
1318
1415
  return True
1319
1416
  else:
1320
- pydev_log.debug_once('File traced (explicitly included by filters): %s', original_filename)
1417
+ if DEBUG:
1418
+ pydev_log.debug_once("File traced (explicitly included by filters): %s", original_filename)
1321
1419
 
1322
1420
  self._apply_filter_cache[cache_key] = False
1323
1421
  return False
@@ -1326,16 +1424,20 @@ class PyDB(object):
1326
1424
  # ignore library files while stepping
1327
1425
  self._apply_filter_cache[cache_key] = True
1328
1426
  if force_check_project_scope:
1329
- pydev_log.debug_once('File not traced (not in project): %s', original_filename)
1427
+ if DEBUG:
1428
+ pydev_log.debug_once("File not traced (not in project): %s", original_filename)
1330
1429
  else:
1331
- pydev_log.debug_once('File not traced (not in project - force_check_project_scope): %s', original_filename)
1430
+ if DEBUG:
1431
+ pydev_log.debug_once("File not traced (not in project - force_check_project_scope): %s", original_filename)
1332
1432
 
1333
1433
  return True
1334
1434
 
1335
1435
  if force_check_project_scope:
1336
- pydev_log.debug_once('File traced: %s (force_check_project_scope)', original_filename)
1436
+ if DEBUG:
1437
+ pydev_log.debug_once("File traced: %s (force_check_project_scope)", original_filename)
1337
1438
  else:
1338
- pydev_log.debug_once('File traced: %s', original_filename)
1439
+ if DEBUG:
1440
+ pydev_log.debug_once("File traced: %s", original_filename)
1339
1441
  self._apply_filter_cache[cache_key] = False
1340
1442
  return False
1341
1443
 
@@ -1349,28 +1451,25 @@ class PyDB(object):
1349
1451
  ignore_libraries = exception_breakpoint.ignore_libraries
1350
1452
  exclude_filters_enabled = self._exclude_filters_enabled
1351
1453
 
1352
- if (ignore_libraries and not self.in_project_scope(trace.tb_frame)) \
1353
- or (exclude_filters_enabled and self._exclude_by_filter(
1354
- trace.tb_frame,
1355
- pydevd_file_utils.absolute_path(trace.tb_frame.f_code.co_filename))):
1454
+ if (ignore_libraries and not self.in_project_scope(trace.tb_frame)) or (
1455
+ exclude_filters_enabled
1456
+ and self._exclude_by_filter(trace.tb_frame, pydevd_file_utils.absolute_path(trace.tb_frame.f_code.co_filename))
1457
+ ):
1356
1458
  return True
1357
1459
 
1358
1460
  return False
1359
1461
 
1360
1462
  def set_project_roots(self, project_roots):
1361
1463
  self._files_filtering.set_project_roots(project_roots)
1362
- self._clear_skip_caches()
1363
- self._clear_filters_caches()
1464
+ self._clear_caches()
1364
1465
 
1365
1466
  def set_exclude_filters(self, exclude_filters):
1366
1467
  self._files_filtering.set_exclude_filters(exclude_filters)
1367
- self._clear_skip_caches()
1368
- self._clear_filters_caches()
1468
+ self._clear_caches()
1369
1469
 
1370
1470
  def set_use_libraries_filter(self, use_libraries_filter):
1371
1471
  self._files_filtering.set_use_libraries_filter(use_libraries_filter)
1372
- self._clear_skip_caches()
1373
- self._clear_filters_caches()
1472
+ self._clear_caches()
1374
1473
 
1375
1474
  def get_use_libraries_filter(self):
1376
1475
  return self._files_filtering.use_libraries_filter()
@@ -1381,8 +1480,7 @@ class PyDB(object):
1381
1480
  def has_user_threads_alive(self):
1382
1481
  for t in pydevd_utils.get_non_pydevd_threads():
1383
1482
  if isinstance(t, PyDBDaemonThread):
1384
- pydev_log.error_once(
1385
- 'Error in debugger: Found PyDBDaemonThread not marked with is_pydev_daemon_thread=True.\n')
1483
+ pydev_log.error_once("Error in debugger: Found PyDBDaemonThread not marked with is_pydev_daemon_thread=True.\n")
1386
1484
 
1387
1485
  if is_thread_alive(t):
1388
1486
  if not t.daemon or hasattr(t, "__pydevd_main_thread"):
@@ -1396,8 +1494,8 @@ class PyDB(object):
1396
1494
  sock.settimeout(None) # infinite, no timeouts from now on - jython does not have it
1397
1495
  except:
1398
1496
  pass
1399
- curr_reader = getattr(self, 'reader', None)
1400
- curr_writer = getattr(self, 'writer', None)
1497
+ curr_reader = getattr(self, "reader", None)
1498
+ curr_writer = getattr(self, "writer", None)
1401
1499
  if curr_reader:
1402
1500
  curr_reader.do_kill_pydev_thread()
1403
1501
  if curr_writer:
@@ -1409,7 +1507,7 @@ class PyDB(object):
1409
1507
  self,
1410
1508
  PyDevJsonCommandProcessor=PyDevJsonCommandProcessor,
1411
1509
  process_net_command=process_net_command,
1412
- terminate_on_socket_close=terminate_on_socket_close
1510
+ terminate_on_socket_close=terminate_on_socket_close,
1413
1511
  )
1414
1512
  self.writer.start()
1415
1513
  self.reader.start()
@@ -1426,7 +1524,7 @@ class PyDB(object):
1426
1524
 
1427
1525
  def create_wait_for_connection_thread(self):
1428
1526
  if self._waiting_for_connection_thread is not None:
1429
- raise AssertionError('There is already another thread waiting for a connection.')
1527
+ raise AssertionError("There is already another thread waiting for a connection.")
1430
1528
 
1431
1529
  self._server_socket_ready_event.clear()
1432
1530
  self._waiting_for_connection_thread = self._WaitForConnectionThread(self)
@@ -1446,14 +1544,13 @@ class PyDB(object):
1446
1544
  self._dap_messages_listeners.append(listener)
1447
1545
 
1448
1546
  class _WaitForConnectionThread(PyDBDaemonThread):
1449
-
1450
1547
  def __init__(self, py_db):
1451
1548
  PyDBDaemonThread.__init__(self, py_db)
1452
1549
  self._server_socket = None
1453
1550
 
1454
1551
  def run(self):
1455
- host = SetupHolder.setup['client']
1456
- port = SetupHolder.setup['port']
1552
+ host = SetupHolder.setup["client"]
1553
+ port = SetupHolder.setup["port"]
1457
1554
 
1458
1555
  self._server_socket = create_server_socket(host=host, port=port)
1459
1556
  self.py_db._server_socket_name = self._server_socket.getsockname()
@@ -1472,7 +1569,7 @@ class PyDB(object):
1472
1569
  return
1473
1570
 
1474
1571
  pydev_log.info("Connection (from wait_for_attach) accepted.")
1475
- reader = getattr(self.py_db, 'reader', None)
1572
+ reader = getattr(self.py_db, "reader", None)
1476
1573
  if reader is not None:
1477
1574
  # This is needed if a new connection is done without the client properly
1478
1575
  # sending a disconnect for the previous connection.
@@ -1496,27 +1593,28 @@ class PyDB(object):
1496
1593
  pass
1497
1594
  self._server_socket = None
1498
1595
 
1499
- def get_internal_queue(self, thread_id):
1500
- """ returns internal command queue for a given thread.
1501
- if new queue is created, notify the RDB about it """
1502
- if thread_id.startswith('__frame__'):
1503
- thread_id = thread_id[thread_id.rfind('|') + 1:]
1504
- return self._cmd_queue[thread_id]
1596
+ def get_internal_queue_and_event(self, thread_id) -> Tuple[_queue.Queue, ThreadingEvent]:
1597
+ """returns internal command queue for a given thread.
1598
+ if new queue is created, notify the RDB about it"""
1599
+ if thread_id.startswith("__frame__"):
1600
+ thread_id = thread_id[thread_id.rfind("|") + 1 :]
1601
+ return self._cmd_queue[thread_id], self._thread_events[thread_id]
1505
1602
 
1506
1603
  def post_method_as_internal_command(self, thread_id, method, *args, **kwargs):
1507
- if thread_id == '*':
1604
+ if thread_id == "*":
1508
1605
  internal_cmd = InternalThreadCommandForAnyThread(thread_id, method, *args, **kwargs)
1509
1606
  else:
1510
1607
  internal_cmd = InternalThreadCommand(thread_id, method, *args, **kwargs)
1511
1608
  self.post_internal_command(internal_cmd, thread_id)
1512
- if thread_id == '*':
1513
- # Notify so that the command is handled as soon as possible.
1514
- self._py_db_command_thread_event.set()
1515
1609
 
1516
1610
  def post_internal_command(self, int_cmd, thread_id):
1517
- """ if thread_id is *, post to the '*' queue"""
1518
- queue = self.get_internal_queue(thread_id)
1611
+ """if thread_id is *, post to the '*' queue"""
1612
+ queue, event = self.get_internal_queue_and_event(thread_id)
1519
1613
  queue.put(int_cmd)
1614
+ if thread_id == "*":
1615
+ self._py_db_command_thread_event.set()
1616
+ else:
1617
+ event.set()
1520
1618
 
1521
1619
  def enable_output_redirection(self, redirect_stdout, redirect_stderr):
1522
1620
  global _global_redirect_stdout_to_server
@@ -1540,13 +1638,6 @@ class PyDB(object):
1540
1638
  if _global_redirect_stderr_to_server:
1541
1639
  _init_stderr_redirect()
1542
1640
 
1543
- def init_matplotlib_in_debug_console(self):
1544
- # import hook and patches for matplotlib support in debug console
1545
- from _pydev_bundle.pydev_import_hook import import_hook_manager
1546
- if is_current_thread_main_thread():
1547
- for module in list(self.mpl_modules_for_patching):
1548
- import_hook_manager.add_module_name(module, self.mpl_modules_for_patching.pop(module))
1549
-
1550
1641
  def init_gui_support(self):
1551
1642
  if self._installed_gui_support:
1552
1643
  return
@@ -1569,13 +1660,15 @@ class PyDB(object):
1569
1660
 
1570
1661
  set_return_control_callback(return_control)
1571
1662
 
1572
- if self._gui_event_loop == 'matplotlib':
1663
+ if self._gui_event_loop == "matplotlib":
1573
1664
  # prepare debugger for matplotlib integration with GUI event loop
1574
1665
  from pydev_ipython.matplotlibtools import activate_matplotlib, activate_pylab, activate_pyplot, do_enable_gui
1575
1666
 
1576
- self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
1577
- "matplotlib.pyplot": activate_pyplot,
1578
- "pylab": activate_pylab }
1667
+ self.mpl_modules_for_patching = {
1668
+ "matplotlib": lambda: activate_matplotlib(do_enable_gui),
1669
+ "matplotlib.pyplot": activate_pyplot,
1670
+ "pylab": activate_pylab,
1671
+ }
1579
1672
  else:
1580
1673
  self.activate_gui_function = enable_gui
1581
1674
 
@@ -1602,6 +1695,7 @@ class PyDB(object):
1602
1695
  except ValueError:
1603
1696
  # The user requested a custom GUI event loop, try to import it.
1604
1697
  from pydev_ipython.inputhook import set_inputhook
1698
+
1605
1699
  try:
1606
1700
  inputhook_function = import_attr_from_module(self._gui_event_loop)
1607
1701
  set_inputhook(inputhook_function)
@@ -1614,6 +1708,7 @@ class PyDB(object):
1614
1708
  def _call_input_hook(self):
1615
1709
  try:
1616
1710
  from pydev_ipython.inputhook import get_inputhook
1711
+
1617
1712
  inputhook = get_inputhook()
1618
1713
  if inputhook:
1619
1714
  inputhook()
@@ -1649,7 +1744,7 @@ class PyDB(object):
1649
1744
  self.writer.add_command(self.cmd_factory.make_thread_created_message(thread))
1650
1745
 
1651
1746
  def notify_thread_not_alive(self, thread_id, use_lock=True):
1652
- """ if thread is not alive, cancel trace_dispatch processing """
1747
+ """if thread is not alive, cancel trace_dispatch processing"""
1653
1748
  if self.writer is None:
1654
1749
  return
1655
1750
 
@@ -1665,6 +1760,7 @@ class PyDB(object):
1665
1760
  was_notified = additional_info.pydev_notify_kill
1666
1761
  if not was_notified:
1667
1762
  additional_info.pydev_notify_kill = True
1763
+ remove_additional_info(additional_info)
1668
1764
 
1669
1765
  self.writer.add_command(self.cmd_factory.make_thread_killed_message(thread_id))
1670
1766
 
@@ -1678,10 +1774,10 @@ class PyDB(object):
1678
1774
  # (so, clear the cache related to that).
1679
1775
  self._running_thread_ids = {}
1680
1776
 
1681
- def process_internal_commands(self):
1682
- '''
1777
+ def process_internal_commands(self, process_thread_ids: Optional[tuple] = None):
1778
+ """
1683
1779
  This function processes internal commands.
1684
- '''
1780
+ """
1685
1781
  # If this method is being called before the debugger is ready to run we should not notify
1686
1782
  # about threads and should only process commands sent to all threads.
1687
1783
  ready_to_run = self.ready_to_run
@@ -1698,10 +1794,10 @@ class PyDB(object):
1698
1794
  reset_cache = not self._running_thread_ids
1699
1795
 
1700
1796
  for t in all_threads:
1701
- if getattr(t, 'is_pydev_daemon_thread', False):
1797
+ if getattr(t, "is_pydev_daemon_thread", False):
1702
1798
  pass # I.e.: skip the DummyThreads created from pydev daemon threads
1703
1799
  elif isinstance(t, PyDBDaemonThread):
1704
- pydev_log.error_once('Error in debugger: Found PyDBDaemonThread not marked with is_pydev_daemon_thread=True.')
1800
+ pydev_log.error_once("Error in debugger: Found PyDBDaemonThread not marked with is_pydev_daemon_thread=True.")
1705
1801
 
1706
1802
  elif is_thread_alive(t):
1707
1803
  if reset_cache:
@@ -1732,17 +1828,18 @@ class PyDB(object):
1732
1828
  if len(program_threads_alive) == 0 and ready_to_run:
1733
1829
  dispose = True
1734
1830
  else:
1735
- # Actually process the commands now (make sure we don't have a lock for _lock_running_thread_ids
1736
- # acquired at this point as it could lead to a deadlock if some command evaluated tried to
1737
- # create a thread and wait for it -- which would try to notify about it getting that lock).
1738
1831
  curr_thread_id = get_current_thread_id(threadingCurrentThread())
1739
- if ready_to_run:
1740
- process_thread_ids = (curr_thread_id, '*')
1741
- else:
1742
- process_thread_ids = ('*',)
1832
+ if process_thread_ids is None:
1833
+ # Actually process the commands now (make sure we don't have a lock for _lock_running_thread_ids
1834
+ # acquired at this point as it could lead to a deadlock if some command evaluated tried to
1835
+ # create a thread and wait for it -- which would try to notify about it getting that lock).
1836
+ if ready_to_run:
1837
+ process_thread_ids = (curr_thread_id, "*")
1838
+ else:
1839
+ process_thread_ids = ("*",)
1743
1840
 
1744
1841
  for thread_id in process_thread_ids:
1745
- queue = self.get_internal_queue(thread_id)
1842
+ queue, _event = self.get_internal_queue_and_event(thread_id)
1746
1843
 
1747
1844
  # some commands must be processed by the thread itself... if that's the case,
1748
1845
  # we will re-add the commands to the queue after executing.
@@ -1750,39 +1847,33 @@ class PyDB(object):
1750
1847
 
1751
1848
  try:
1752
1849
  while True:
1753
- int_cmd = queue.get(False)
1754
-
1755
- if not self.mpl_hooks_in_debug_console and isinstance(int_cmd, InternalConsoleExec) and not self.gui_in_use:
1756
- # add import hooks for matplotlib patches if only debug console was started
1757
- try:
1758
- self.init_matplotlib_in_debug_console()
1759
- self.gui_in_use = True
1760
- except:
1761
- pydev_log.debug("Matplotlib support in debug console failed", traceback.format_exc())
1762
- self.mpl_hooks_in_debug_console = True
1763
-
1764
- if int_cmd.can_be_executed_by(curr_thread_id):
1765
- cmds_to_execute.append(int_cmd)
1766
- else:
1767
- pydev_log.verbose("NOT processing internal command: %s ", int_cmd)
1768
- cmds_to_add_back.append(int_cmd)
1850
+ internal_cmd = queue.get(False)
1851
+ try:
1852
+ if internal_cmd.can_be_executed_by(curr_thread_id):
1853
+ cmds_to_execute.append(internal_cmd)
1854
+ else:
1855
+ pydev_log.verbose("NOT processing internal command: %s ", internal_cmd)
1856
+ cmds_to_add_back.append(internal_cmd)
1857
+ except:
1858
+ pydev_log.exception()
1859
+ raise
1769
1860
 
1770
1861
  except _queue.Empty: # @UndefinedVariable
1771
1862
  # this is how we exit
1772
- for int_cmd in cmds_to_add_back:
1773
- queue.put(int_cmd)
1863
+ for internal_cmd in cmds_to_add_back:
1864
+ queue.put(internal_cmd)
1774
1865
 
1775
1866
  if dispose:
1776
1867
  # Note: must be called without the main lock to avoid deadlocks.
1777
1868
  self.dispose_and_kill_all_pydevd_threads()
1778
1869
  else:
1779
1870
  # Actually execute the commands without the main lock!
1780
- for int_cmd in cmds_to_execute:
1781
- pydev_log.verbose("processing internal command: %s", int_cmd)
1871
+ for internal_cmd in cmds_to_execute:
1872
+ pydev_log.verbose("processing internal command: %s", internal_cmd)
1782
1873
  try:
1783
- int_cmd.do_it(self)
1874
+ internal_cmd.do_it(self)
1784
1875
  except:
1785
- pydev_log.exception('Error processing internal command.')
1876
+ pydev_log.exception("Error processing internal command.")
1786
1877
 
1787
1878
  def consolidate_breakpoints(self, canonical_normalized_filename, id_to_breakpoint, file_to_line_to_breakpoints):
1788
1879
  break_dict = {}
@@ -1790,11 +1881,7 @@ class PyDB(object):
1790
1881
  break_dict[pybreakpoint.line] = pybreakpoint
1791
1882
 
1792
1883
  file_to_line_to_breakpoints[canonical_normalized_filename] = break_dict
1793
- self._clear_skip_caches()
1794
-
1795
- def _clear_skip_caches(self):
1796
- global_cache_skips.clear()
1797
- global_cache_frame_skips.clear()
1884
+ self._clear_caches()
1798
1885
 
1799
1886
  def add_break_on_exception(
1800
1887
  self,
@@ -1805,8 +1892,8 @@ class PyDB(object):
1805
1892
  notify_on_unhandled_exceptions,
1806
1893
  notify_on_user_unhandled_exceptions,
1807
1894
  notify_on_first_raise_only,
1808
- ignore_libraries=False
1809
- ):
1895
+ ignore_libraries=False,
1896
+ ):
1810
1897
  try:
1811
1898
  eb = ExceptionBreakpoint(
1812
1899
  exception,
@@ -1816,7 +1903,7 @@ class PyDB(object):
1816
1903
  notify_on_unhandled_exceptions,
1817
1904
  notify_on_user_unhandled_exceptions,
1818
1905
  notify_on_first_raise_only,
1819
- ignore_libraries
1906
+ ignore_libraries,
1820
1907
  )
1821
1908
  except ImportError:
1822
1909
  pydev_log.critical("Error unable to add break on exception for: %s (exception could not be imported).", exception)
@@ -1842,8 +1929,16 @@ class PyDB(object):
1842
1929
 
1843
1930
  return eb
1844
1931
 
1845
- def set_suspend(self, thread, stop_reason, suspend_other_threads=False, is_pause=False, original_step_cmd=-1):
1846
- '''
1932
+ def set_suspend(
1933
+ self,
1934
+ thread,
1935
+ stop_reason: int,
1936
+ suspend_other_threads: bool = False,
1937
+ is_pause=False,
1938
+ original_step_cmd: int = -1,
1939
+ suspend_requested: bool = False,
1940
+ ):
1941
+ """
1847
1942
  :param thread:
1848
1943
  The thread which should be suspended.
1849
1944
 
@@ -1860,19 +1955,29 @@ class PyDB(object):
1860
1955
 
1861
1956
  :param original_step_cmd:
1862
1957
  If given we may change the stop reason to this.
1863
- '''
1958
+
1959
+ :param suspend_requested:
1960
+ If the execution will be suspended right away then this may be false, otherwise,
1961
+ if the thread should be stopped due to this suspend at a later time then it
1962
+ should be true.
1963
+ """
1864
1964
  self._threads_suspended_single_notification.increment_suspend_time()
1865
1965
  if is_pause:
1866
1966
  self._threads_suspended_single_notification.on_pause()
1867
1967
 
1868
1968
  info = mark_thread_suspended(thread, stop_reason, original_step_cmd=original_step_cmd)
1869
1969
 
1970
+ if (suspend_requested or is_pause) and PYDEVD_USE_SYS_MONITORING:
1971
+ pydevd_sys_monitoring.update_monitor_events(suspend_requested=True)
1972
+
1870
1973
  if is_pause:
1871
1974
  # Must set tracing after setting the state to suspend.
1872
1975
  frame = info.get_topmost_frame(thread)
1873
1976
  if frame is not None:
1977
+ # Where suspend was requested
1978
+ # traceback.print_stack(frame)
1874
1979
  try:
1875
- self.set_trace_for_frame_and_parents(frame)
1980
+ self.set_trace_for_frame_and_parents(thread.ident, frame)
1876
1981
  finally:
1877
1982
  frame = None
1878
1983
 
@@ -1891,6 +1996,9 @@ class PyDB(object):
1891
1996
  # Suspend all except the current one (which we're currently suspending already).
1892
1997
  suspend_all_threads(self, except_thread=thread)
1893
1998
 
1999
+ if PYDEVD_USE_SYS_MONITORING:
2000
+ pydevd_sys_monitoring.restart_events()
2001
+
1894
2002
  def _send_breakpoint_condition_exception(self, thread, conditional_breakpoint_exception_tuple):
1895
2003
  """If conditional breakpoint raises an exception during evaluation
1896
2004
  send exception details to java
@@ -1912,24 +2020,21 @@ class PyDB(object):
1912
2020
  self.post_internal_command(int_cmd, thread_id)
1913
2021
 
1914
2022
  def send_caught_exception_stack_proceeded(self, thread):
1915
- """Sends that some thread was resumed and is no longer showing an exception trace.
1916
- """
2023
+ """Sends that some thread was resumed and is no longer showing an exception trace."""
1917
2024
  thread_id = get_thread_id(thread)
1918
2025
  int_cmd = InternalSendCurrExceptionTraceProceeded(thread_id)
1919
2026
  self.post_internal_command(int_cmd, thread_id)
1920
2027
  self.process_internal_commands()
1921
2028
 
1922
2029
  def send_process_created_message(self):
1923
- """Sends a message that a new process has been created.
1924
- """
2030
+ """Sends a message that a new process has been created."""
1925
2031
  if self.writer is None or self.cmd_factory is None:
1926
2032
  return
1927
2033
  cmd = self.cmd_factory.make_process_created_message()
1928
2034
  self.writer.add_command(cmd)
1929
2035
 
1930
2036
  def send_process_about_to_be_replaced(self):
1931
- """Sends a message that a new process has been created.
1932
- """
2037
+ """Sends a message that a new process has been created."""
1933
2038
  if self.writer is None or self.cmd_factory is None:
1934
2039
  return
1935
2040
  cmd = self.cmd_factory.make_process_about_to_be_replaced_message()
@@ -1947,17 +2052,17 @@ class PyDB(object):
1947
2052
  timeout = 5 # Wait up to 5 seconds
1948
2053
  initial_time = time.time()
1949
2054
  while not sent[0]:
1950
- time.sleep(.05)
2055
+ time.sleep(0.05)
1951
2056
 
1952
2057
  if (time.time() - initial_time) > timeout:
1953
- pydev_log.critical('pydevd: Sending message related to process being replaced timed-out after %s seconds', timeout)
2058
+ pydev_log.critical("pydevd: Sending message related to process being replaced timed-out after %s seconds", timeout)
1954
2059
  break
1955
2060
 
1956
2061
  def set_next_statement(self, frame, event, func_name, next_line):
1957
2062
  stop = False
1958
2063
  response_msg = ""
1959
2064
  old_line = frame.f_lineno
1960
- if event == 'line' or event == 'exception':
2065
+ if event == "line" or event == "exception":
1961
2066
  # If we're already in the correct context, we have to stop it now, because we can act only on
1962
2067
  # line events -- if a return was the next statement it wouldn't work (so, we have this code
1963
2068
  # repeated at pydevd_frame).
@@ -1965,10 +2070,10 @@ class PyDB(object):
1965
2070
  curr_func_name = frame.f_code.co_name
1966
2071
 
1967
2072
  # global context is set with an empty name
1968
- if curr_func_name in ('?', '<module>'):
1969
- curr_func_name = ''
2073
+ if curr_func_name in ("?", "<module>"):
2074
+ curr_func_name = ""
1970
2075
 
1971
- if func_name == '*' or curr_func_name == func_name:
2076
+ if func_name == "*" or curr_func_name == func_name:
1972
2077
  line = next_line
1973
2078
  frame.f_trace = self.trace_dispatch
1974
2079
  frame.f_lineno = line
@@ -1982,18 +2087,22 @@ class PyDB(object):
1982
2087
  try:
1983
2088
  all_threads = threadingEnumerate()
1984
2089
  for t in all_threads:
1985
- if getattr(t, 'is_pydev_daemon_thread', False) and hasattr(t, 'cancel_event') and t.thread_id == thread_id and \
1986
- t.frame_id == frame_id:
2090
+ if (
2091
+ getattr(t, "is_pydev_daemon_thread", False)
2092
+ and hasattr(t, "cancel_event")
2093
+ and t.thread_id == thread_id
2094
+ and t.frame_id == frame_id
2095
+ ):
1987
2096
  t.cancel_event.set()
1988
2097
  except:
1989
2098
  pydev_log.exception()
1990
2099
 
1991
2100
  def find_frame(self, thread_id, frame_id):
1992
- """ returns a frame on the thread that has a given frame_id """
2101
+ """returns a frame on the thread that has a given frame_id"""
1993
2102
  return self.suspended_frames_manager.find_frame(thread_id, frame_id)
1994
2103
 
1995
2104
  def do_wait_suspend(self, thread, frame, event, arg, exception_type=None): # @UnusedVariable
1996
- """ busy waits until the thread state changes to RUN
2105
+ """busy waits until the thread state changes to RUN
1997
2106
  it expects thread's state as attributes of the thread.
1998
2107
  Upon running, processes any outstanding Stepping commands.
1999
2108
 
@@ -2002,35 +2111,43 @@ class PyDB(object):
2002
2111
  """
2003
2112
  if USE_CUSTOM_SYS_CURRENT_FRAMES_MAP:
2004
2113
  constructed_tid_to_last_frame[thread.ident] = sys._getframe()
2005
- self.process_internal_commands()
2114
+
2115
+ # Only process from all threads, not for current one (we'll do that later on in this method).
2116
+ self.process_internal_commands(("*",))
2006
2117
 
2007
2118
  thread_id = get_current_thread_id(thread)
2008
2119
 
2009
- # print('do_wait_suspend %s %s %s %s %s %s (%s)' % (frame.f_lineno, frame.f_code.co_name, frame.f_code.co_filename, event, arg, constant_to_str(thread.additional_info.pydev_step_cmd), constant_to_str(thread.additional_info.pydev_original_step_cmd)))
2010
- # print('--- stack ---')
2011
- # print(traceback.print_stack(file=sys.stdout))
2012
- # print('--- end stack ---')
2120
+ # if DebugInfoHolder.DEBUG_TRACE_LEVEL >= 2:
2121
+ # pydev_log.debug('do_wait_suspend %s %s %s %s %s %s (%s)' % (frame.f_lineno, frame.f_code.co_name, frame.f_code.co_filename, event, arg, constant_to_str(thread.additional_info.pydev_step_cmd), constant_to_str(thread.additional_info.pydev_original_step_cmd)))
2122
+ # pydev_log.debug('--- internal stack ---')
2123
+ # _f = sys._getframe()
2124
+ # while _f is not None:
2125
+ # pydev_log.debug(' -> %s' % (_f))
2126
+ # _f = _f.f_back
2127
+ # pydev_log.debug('--- end internal stack ---')
2013
2128
 
2014
2129
  # Send the suspend message
2015
2130
  message = thread.additional_info.pydev_message
2016
- suspend_type = thread.additional_info.trace_suspend_type
2017
- thread.additional_info.trace_suspend_type = 'trace' # Reset to trace mode for next call.
2131
+ trace_suspend_type = thread.additional_info.trace_suspend_type
2132
+ thread.additional_info.trace_suspend_type = "trace" # Reset to trace mode for next call.
2018
2133
  stop_reason = thread.stop_reason
2019
2134
 
2020
2135
  frames_list = None
2021
2136
 
2022
- if arg is not None and event == 'exception':
2137
+ if arg is not None and event == "exception":
2023
2138
  # arg must be the exception info (tuple(exc_type, exc, traceback))
2024
2139
  exc_type, exc_desc, trace_obj = arg
2025
2140
  if trace_obj is not None:
2026
- frames_list = pydevd_frame_utils.create_frames_list_from_traceback(trace_obj, frame, exc_type, exc_desc, exception_type=exception_type)
2141
+ frames_list = pydevd_frame_utils.create_frames_list_from_traceback(
2142
+ trace_obj, frame, exc_type, exc_desc, exception_type=exception_type
2143
+ )
2027
2144
 
2028
2145
  if frames_list is None:
2029
2146
  frames_list = pydevd_frame_utils.create_frames_list_from_frame(frame)
2030
2147
 
2031
2148
  if DebugInfoHolder.DEBUG_TRACE_LEVEL > 2:
2032
2149
  pydev_log.debug(
2033
- 'PyDB.do_wait_suspend\nname: %s (line: %s)\n file: %s\n event: %s\n arg: %s\n step: %s (original step: %s)\n thread: %s, thread id: %s, id(thread): %s',
2150
+ "PyDB.do_wait_suspend\nname: %s (line: %s)\n file: %s\n event: %s\n arg: %s\n step: %s (original step: %s)\n thread: %s, thread id: %s, id(thread): %s",
2034
2151
  frame.f_code.co_name,
2035
2152
  frame.f_lineno,
2036
2153
  frame.f_code.co_filename,
@@ -2043,11 +2160,13 @@ class PyDB(object):
2043
2160
  id(thread),
2044
2161
  )
2045
2162
  for f in frames_list:
2046
- pydev_log.debug(' Stack: %s, %s, %s', f.f_code.co_filename, f.f_code.co_name, f.f_lineno)
2163
+ pydev_log.debug(" Stack: %s, %s, %s", f.f_code.co_filename, f.f_code.co_name, f.f_lineno)
2047
2164
 
2048
2165
  with self.suspended_frames_manager.track_frames(self) as frames_tracker:
2049
2166
  frames_tracker.track(thread_id, frames_list)
2050
- cmd = frames_tracker.create_thread_suspend_command(thread_id, stop_reason, message, suspend_type)
2167
+ cmd = frames_tracker.create_thread_suspend_command(
2168
+ thread_id, stop_reason, message, trace_suspend_type, thread, thread.additional_info
2169
+ )
2051
2170
  self.writer.add_command(cmd)
2052
2171
 
2053
2172
  with CustomFramesContainer.custom_frames_lock: # @UndefinedVariable
@@ -2055,19 +2174,27 @@ class PyDB(object):
2055
2174
 
2056
2175
  for frame_custom_thread_id, custom_frame in CustomFramesContainer.custom_frames.items():
2057
2176
  if custom_frame.thread_id == thread.ident:
2058
- frames_tracker.track(thread_id, pydevd_frame_utils.create_frames_list_from_frame(custom_frame.frame), frame_custom_thread_id=frame_custom_thread_id)
2177
+ frames_tracker.track(
2178
+ thread_id,
2179
+ pydevd_frame_utils.create_frames_list_from_frame(custom_frame.frame),
2180
+ frame_custom_thread_id=frame_custom_thread_id,
2181
+ )
2059
2182
  # print('Frame created as thread: %s' % (frame_custom_thread_id,))
2060
2183
 
2061
- self.writer.add_command(self.cmd_factory.make_custom_frame_created_message(
2062
- frame_custom_thread_id, custom_frame.name))
2184
+ self.writer.add_command(
2185
+ self.cmd_factory.make_custom_frame_created_message(frame_custom_thread_id, custom_frame.name)
2186
+ )
2063
2187
 
2064
2188
  self.writer.add_command(
2065
- frames_tracker.create_thread_suspend_command(frame_custom_thread_id, CMD_THREAD_SUSPEND, "", suspend_type))
2189
+ frames_tracker.create_thread_suspend_command(
2190
+ frame_custom_thread_id, CMD_THREAD_SUSPEND, "", trace_suspend_type, thread, thread.additional_info
2191
+ )
2192
+ )
2066
2193
 
2067
2194
  from_this_thread.append(frame_custom_thread_id)
2068
2195
 
2069
2196
  with self._threads_suspended_single_notification.notify_thread_suspended(thread_id, thread, stop_reason):
2070
- keep_suspended = self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker)
2197
+ keep_suspended = self._do_wait_suspend(thread, frame, event, arg, trace_suspend_type, from_this_thread, frames_tracker)
2071
2198
 
2072
2199
  frames_list = None
2073
2200
 
@@ -2076,34 +2203,72 @@ class PyDB(object):
2076
2203
  self._threads_suspended_single_notification.increment_suspend_time()
2077
2204
  self.do_wait_suspend(thread, frame, event, arg, exception_type)
2078
2205
  if DebugInfoHolder.DEBUG_TRACE_LEVEL > 2:
2079
- pydev_log.debug('Leaving PyDB.do_wait_suspend: %s (%s) %s', thread, thread_id, id(thread))
2206
+ pydev_log.debug("Leaving PyDB.do_wait_suspend: %s (%s) %s", thread, thread_id, id(thread))
2080
2207
 
2081
- def _do_wait_suspend(self, thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker):
2208
+ def _do_wait_suspend(self, thread, frame, event, arg, trace_suspend_type, from_this_thread, frames_tracker):
2082
2209
  info = thread.additional_info
2083
- info.step_in_initial_location = None
2084
- keep_suspended = False
2210
+ try:
2211
+ info.is_in_wait_loop = True
2212
+ info.update_stepping_info()
2213
+ info.step_in_initial_location = None
2214
+ keep_suspended = False
2085
2215
 
2086
- with self._main_lock: # Use lock to check if suspended state changed
2087
- activate_gui = info.pydev_state == STATE_SUSPEND and not self.pydb_disposed
2216
+ with self._main_lock: # Use lock to check if suspended state changed
2217
+ activate_gui = info.pydev_state == STATE_SUSPEND and not self.pydb_disposed
2218
+
2219
+ in_main_thread = is_current_thread_main_thread()
2220
+ if activate_gui and in_main_thread:
2221
+ # before every stop check if matplotlib modules were imported inside script code
2222
+ # or some GUI event loop needs to be activated
2223
+ self._activate_gui_if_needed()
2224
+
2225
+ # self.process_internal_commands(): processes for all the threads
2226
+ # and updates running threads. This was called once in `do_wait_suspend`
2227
+ # At this point it's just processing for this thread.
2228
+ # Note that clients may not post an actual event (for instance, it
2229
+ # could just set the internal state and signal the event instead
2230
+ # of posting a command to the queue). In any case, if an item is
2231
+ # put in the queue, the event must be set too.
2232
+ curr_thread_id = get_current_thread_id(threadingCurrentThread())
2233
+ queue, notify_event = self.get_internal_queue_and_event(curr_thread_id)
2234
+
2235
+ wait_timeout = TIMEOUT_SLOW
2236
+ while True:
2237
+ with self._main_lock: # Use lock to check if suspended state changed
2238
+ if info.pydev_state != STATE_SUSPEND or (self.pydb_disposed and not self.terminate_requested):
2239
+ # Note: we can't exit here if terminate was requested while a breakpoint was hit.
2240
+ break
2088
2241
 
2089
- in_main_thread = is_current_thread_main_thread()
2090
- if activate_gui and in_main_thread:
2091
- # before every stop check if matplotlib modules were imported inside script code
2092
- # or some GUI event loop needs to be activated
2093
- self._activate_gui_if_needed()
2242
+ if in_main_thread and self.gui_in_use:
2243
+ wait_timeout = TIMEOUT_FAST
2244
+ # call input hooks if only GUI is in use
2245
+ self._call_input_hook()
2094
2246
 
2095
- while True:
2096
- with self._main_lock: # Use lock to check if suspended state changed
2097
- if info.pydev_state != STATE_SUSPEND or (self.pydb_disposed and not self.terminate_requested):
2098
- # Note: we can't exit here if terminate was requested while a breakpoint was hit.
2099
- break
2247
+ # No longer process commands for '*' at this point, just the
2248
+ # ones related to this thread.
2249
+ try:
2250
+ internal_cmd = queue.get(False)
2251
+ except _queue.Empty:
2252
+ pass
2253
+ else:
2254
+ if internal_cmd.can_be_executed_by(curr_thread_id):
2255
+ pydev_log.verbose("processing internal command: %s", internal_cmd)
2256
+ try:
2257
+ internal_cmd.do_it(self)
2258
+ except:
2259
+ pydev_log.exception("Error processing internal command.")
2260
+ else:
2261
+ # This shouldn't really happen...
2262
+ pydev_log.verbose("NOT processing internal command: %s ", internal_cmd)
2263
+ queue.put(internal_cmd)
2264
+ wait_timeout = TIMEOUT_FAST
2100
2265
 
2101
- if in_main_thread and self.gui_in_use:
2102
- # call input hooks if only GUI is in use
2103
- self._call_input_hook()
2266
+ notify_event.wait(wait_timeout)
2267
+ notify_event.clear()
2104
2268
 
2105
- self.process_internal_commands()
2106
- time.sleep(0.01)
2269
+ finally:
2270
+ info.is_in_wait_loop = False
2271
+ info.update_stepping_info()
2107
2272
 
2108
2273
  self.cancel_async_evaluation(get_current_thread_id(thread), str(id(frame)))
2109
2274
 
@@ -2114,18 +2279,18 @@ class PyDB(object):
2114
2279
  # When in a coroutine we switch to CMD_STEP_INTO_COROUTINE.
2115
2280
  info.pydev_step_cmd = CMD_STEP_INTO_COROUTINE
2116
2281
  info.pydev_step_stop = frame
2117
- self.set_trace_for_frame_and_parents(frame)
2282
+ self.set_trace_for_frame_and_parents(thread.ident, frame)
2118
2283
  else:
2119
2284
  info.pydev_step_stop = None
2120
- self.set_trace_for_frame_and_parents(frame)
2285
+ self.set_trace_for_frame_and_parents(thread.ident, frame)
2121
2286
 
2122
2287
  elif info.pydev_step_cmd in (CMD_STEP_OVER, CMD_STEP_OVER_MY_CODE, CMD_SMART_STEP_INTO):
2123
2288
  info.pydev_step_stop = frame
2124
- self.set_trace_for_frame_and_parents(frame)
2289
+ self.set_trace_for_frame_and_parents(thread.ident, frame)
2125
2290
 
2126
2291
  elif info.pydev_step_cmd == CMD_RUN_TO_LINE or info.pydev_step_cmd == CMD_SET_NEXT_STATEMENT:
2127
2292
  info.pydev_step_stop = None
2128
- self.set_trace_for_frame_and_parents(frame)
2293
+ self.set_trace_for_frame_and_parents(thread.ident, frame)
2129
2294
  stop = False
2130
2295
  response_msg = ""
2131
2296
  try:
@@ -2136,12 +2301,12 @@ class PyDB(object):
2136
2301
  seq = info.pydev_message
2137
2302
  cmd = self.cmd_factory.make_set_next_stmnt_status_message(seq, stop, response_msg)
2138
2303
  self.writer.add_command(cmd)
2139
- info.pydev_message = ''
2304
+ info.pydev_message = ""
2140
2305
 
2141
2306
  if stop:
2142
2307
  # Uninstall the current frames tracker before running it.
2143
2308
  frames_tracker.untrack_all()
2144
- cmd = self.cmd_factory.make_thread_run_message(get_current_thread_id(thread), info.pydev_step_cmd)
2309
+ cmd = self.cmd_factory.make_thread_run_message(self, get_current_thread_id(thread), info.pydev_step_cmd)
2145
2310
  self.writer.add_command(cmd)
2146
2311
  info.pydev_state = STATE_SUSPEND
2147
2312
  thread.stop_reason = CMD_SET_NEXT_STATEMENT
@@ -2155,7 +2320,7 @@ class PyDB(object):
2155
2320
  thread.stop_reason = CMD_THREAD_SUSPEND
2156
2321
  # return to the suspend state and wait for other command (without sending any
2157
2322
  # additional notification to the client).
2158
- return self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker)
2323
+ return self._do_wait_suspend(thread, frame, event, arg, trace_suspend_type, from_this_thread, frames_tracker)
2159
2324
 
2160
2325
  elif info.pydev_step_cmd in (CMD_STEP_RETURN, CMD_STEP_RETURN_MY_CODE):
2161
2326
  back_frame = frame.f_back
@@ -2172,7 +2337,7 @@ class PyDB(object):
2172
2337
  if back_frame is not None:
2173
2338
  # steps back to the same frame (in a return call it will stop in the 'back frame' for the user)
2174
2339
  info.pydev_step_stop = frame
2175
- self.set_trace_for_frame_and_parents(frame)
2340
+ self.set_trace_for_frame_and_parents(thread.ident, frame)
2176
2341
  else:
2177
2342
  # No back frame?!? -- this happens in jython when we have some frame created from an awt event
2178
2343
  # (the previous frame would be the awt event, but this doesn't make part of 'jython', only 'java')
@@ -2184,10 +2349,7 @@ class PyDB(object):
2184
2349
 
2185
2350
  if PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING:
2186
2351
  info.pydev_use_scoped_step_frame = False
2187
- if info.pydev_step_cmd in (
2188
- CMD_STEP_OVER, CMD_STEP_OVER_MY_CODE,
2189
- CMD_STEP_INTO, CMD_STEP_INTO_MY_CODE
2190
- ):
2352
+ if info.pydev_step_cmd in (CMD_STEP_OVER, CMD_STEP_OVER_MY_CODE, CMD_STEP_INTO, CMD_STEP_INTO_MY_CODE):
2191
2353
  # i.e.: We're stepping: check if the stepping should be scoped (i.e.: in ipython
2192
2354
  # each line is executed separately in a new frame, in which case we need to consider
2193
2355
  # the next line as if it was still in the same frame).
@@ -2196,11 +2358,11 @@ class PyDB(object):
2196
2358
  f = f.f_back
2197
2359
  if f and f.f_code.co_name == PYDEVD_IPYTHON_CONTEXT[2]:
2198
2360
  info.pydev_use_scoped_step_frame = True
2199
- pydev_log.info('Using (ipython) scoped stepping.')
2361
+ pydev_log.info("Using (ipython) scoped stepping.")
2200
2362
  del f
2201
2363
 
2202
2364
  del frame
2203
- cmd = self.cmd_factory.make_thread_run_message(get_current_thread_id(thread), info.pydev_step_cmd)
2365
+ cmd = self.cmd_factory.make_thread_run_message(self, get_current_thread_id(thread), info.pydev_step_cmd)
2204
2366
  self.writer.add_command(cmd)
2205
2367
 
2206
2368
  with CustomFramesContainer.custom_frames_lock:
@@ -2209,6 +2371,7 @@ class PyDB(object):
2209
2371
  # print('Removing created frame: %s' % (frame_id,))
2210
2372
  self.writer.add_command(self.cmd_factory.make_thread_killed_message(frame_id))
2211
2373
 
2374
+ info.update_stepping_info()
2212
2375
  return keep_suspended
2213
2376
 
2214
2377
  def do_stop_on_unhandled_exception(self, thread, frame, frames_byid, arg):
@@ -2218,7 +2381,7 @@ class PyDB(object):
2218
2381
  self.send_caught_exception_stack(thread, arg, id(frame))
2219
2382
  try:
2220
2383
  self.set_suspend(thread, CMD_ADD_EXCEPTION_BREAK)
2221
- self.do_wait_suspend(thread, frame, 'exception', arg, EXCEPTION_TYPE_UNHANDLED)
2384
+ self.do_wait_suspend(thread, frame, "exception", arg, EXCEPTION_TYPE_UNHANDLED)
2222
2385
  except:
2223
2386
  self.send_caught_exception_stack_proceeded(thread)
2224
2387
  except:
@@ -2227,25 +2390,51 @@ class PyDB(object):
2227
2390
  remove_exception_from_frame(frame)
2228
2391
  frame = None
2229
2392
 
2230
- def set_trace_for_frame_and_parents(self, frame, **kwargs):
2231
- disable = kwargs.pop('disable', False)
2393
+ def set_trace_for_frame_and_parents(self, thread_ident: Optional[int], frame, **kwargs):
2394
+ disable = kwargs.pop("disable", False)
2232
2395
  assert not kwargs
2233
2396
 
2397
+ DEBUG = True # 'defaulttags' in frame.f_code.co_filename
2398
+
2234
2399
  while frame is not None:
2400
+ if not isinstance(frame, FrameType):
2401
+ # This is the case for django/jinja frames.
2402
+ pydev_log.debug("Not a frame: %s", frame)
2403
+ frame = frame.f_back
2404
+ continue
2405
+
2235
2406
  # Don't change the tracing on debugger-related files
2236
2407
  file_type = self.get_file_type(frame)
2408
+ if PYDEVD_USE_SYS_MONITORING:
2409
+ if file_type is None:
2410
+ if disable:
2411
+ if DEBUG:
2412
+ pydev_log.debug("Disable tracing of frame: %s - %s", frame.f_code.co_filename, frame.f_code.co_name)
2413
+ pydevd_sys_monitoring.disable_code_tracing(frame.f_code)
2237
2414
 
2238
- if file_type is None:
2239
- if disable:
2240
- pydev_log.debug('Disable tracing of frame: %s - %s', frame.f_code.co_filename, frame.f_code.co_name)
2241
- if frame.f_trace is not None and frame.f_trace is not NO_FTRACE:
2242
- frame.f_trace = NO_FTRACE
2243
-
2244
- elif frame.f_trace is not self.trace_dispatch:
2245
- pydev_log.debug('Set tracing of frame: %s - %s', frame.f_code.co_filename, frame.f_code.co_name)
2246
- frame.f_trace = self.trace_dispatch
2415
+ else:
2416
+ if DEBUG:
2417
+ pydev_log.debug("Set tracing of frame: %s - %s", frame.f_code.co_filename, frame.f_code.co_name)
2418
+ pydevd_sys_monitoring.enable_code_tracing(thread_ident, frame.f_code, frame)
2419
+ else:
2420
+ if DEBUG:
2421
+ pydev_log.debug("SKIP set tracing of frame: %s - %s", frame.f_code.co_filename, frame.f_code.co_name)
2247
2422
  else:
2248
- pydev_log.debug('SKIP set tracing of frame: %s - %s', frame.f_code.co_filename, frame.f_code.co_name)
2423
+ # Not using sys.monitoring.
2424
+ if file_type is None:
2425
+ if disable:
2426
+ if DEBUG:
2427
+ pydev_log.debug("Disable tracing of frame: %s - %s", frame.f_code.co_filename, frame.f_code.co_name)
2428
+ if frame.f_trace is not None and frame.f_trace is not NO_FTRACE:
2429
+ frame.f_trace = NO_FTRACE
2430
+
2431
+ elif frame.f_trace is not self.trace_dispatch:
2432
+ if DEBUG:
2433
+ pydev_log.debug("Set tracing of frame: %s - %s", frame.f_code.co_filename, frame.f_code.co_name)
2434
+ frame.f_trace = self.trace_dispatch
2435
+ else:
2436
+ if DEBUG:
2437
+ pydev_log.debug("SKIP set tracing of frame: %s - %s", frame.f_code.co_filename, frame.f_code.co_name)
2249
2438
 
2250
2439
  frame = frame.f_back
2251
2440
 
@@ -2296,19 +2485,18 @@ class PyDB(object):
2296
2485
  while time.time() < started_at + timeout:
2297
2486
  if len(get_pydb_daemon_threads_to_wait()) == 0:
2298
2487
  break
2299
- time.sleep(1 / 10.)
2488
+ time.sleep(1 / 10.0)
2300
2489
  else:
2301
2490
  thread_names = [t.name for t in get_pydb_daemon_threads_to_wait()]
2302
2491
  if thread_names:
2303
- pydev_log.debug("The following pydb threads may not have finished correctly: %s",
2304
- ', '.join(thread_names))
2492
+ pydev_log.debug("The following pydb threads may not have finished correctly: %s", ", ".join(thread_names))
2305
2493
  finally:
2306
2494
  self._wait_for_threads_to_finish_called_event.set()
2307
2495
  except:
2308
2496
  pydev_log.exception()
2309
2497
 
2310
- def dispose_and_kill_all_pydevd_threads(self, wait=True, timeout=.5):
2311
- '''
2498
+ def dispose_and_kill_all_pydevd_threads(self, wait=True, timeout=0.5):
2499
+ """
2312
2500
  When this method is called we finish the debug session, terminate threads
2313
2501
  and if this was registered as the global instance, unregister it -- afterwards
2314
2502
  it should be possible to create a new instance and set as global to start
@@ -2319,12 +2507,14 @@ class PyDB(object):
2319
2507
  (based on the available timeout).
2320
2508
  Note that this must be thread-safe and if one thread is waiting the other thread should
2321
2509
  also wait.
2322
- '''
2510
+ """
2323
2511
  try:
2324
2512
  back_frame = sys._getframe().f_back
2325
2513
  pydev_log.debug(
2326
2514
  'PyDB.dispose_and_kill_all_pydevd_threads (called from: File "%s", line %s, in %s)',
2327
- back_frame.f_code.co_filename, back_frame.f_lineno, back_frame.f_code.co_name
2515
+ back_frame.f_code.co_filename,
2516
+ back_frame.f_lineno,
2517
+ back_frame.f_code.co_name,
2328
2518
  )
2329
2519
  back_frame = None
2330
2520
  with self._disposed_lock:
@@ -2354,7 +2544,7 @@ class PyDB(object):
2354
2544
 
2355
2545
  pydb_daemon_threads = set(self.created_pydb_daemon_threads)
2356
2546
  for t in pydb_daemon_threads:
2357
- if hasattr(t, 'do_kill_pydev_thread'):
2547
+ if hasattr(t, "do_kill_pydev_thread"):
2358
2548
  pydev_log.debug("PyDB.dispose_and_kill_all_pydevd_threads killing thread: %s", t)
2359
2549
  t.do_kill_pydev_thread()
2360
2550
 
@@ -2377,32 +2567,36 @@ class PyDB(object):
2377
2567
  pydev_log.debug("PyDB.dispose_and_kill_all_pydevd_threads: finished")
2378
2568
 
2379
2569
  def prepare_to_run(self):
2380
- ''' Shared code to prepare debugging by installing traces and registering threads '''
2570
+ """Shared code to prepare debugging by installing traces and registering threads"""
2381
2571
  self.patch_threads()
2382
2572
  self.start_auxiliary_daemon_threads()
2383
2573
 
2384
2574
  def patch_threads(self):
2385
- try:
2386
- # not available in jython!
2387
- threading.settrace(self.trace_dispatch) # for all future threads
2388
- except:
2389
- pass
2575
+ if PYDEVD_USE_SYS_MONITORING:
2576
+ pydevd_sys_monitoring.start_monitoring(all_threads=True)
2577
+ else:
2578
+ try:
2579
+ # not available in jython!
2580
+ threading.settrace(self.trace_dispatch) # for all future threads
2581
+ except:
2582
+ pass
2390
2583
 
2391
2584
  from _pydev_bundle.pydev_monkey import patch_thread_modules
2585
+
2392
2586
  patch_thread_modules()
2393
2587
 
2394
2588
  def run(self, file, globals=None, locals=None, is_module=False, set_trace=True):
2395
2589
  module_name = None
2396
- entry_point_fn = ''
2590
+ entry_point_fn = ""
2397
2591
  if is_module:
2398
2592
  # When launching with `python -m <module>`, python automatically adds
2399
2593
  # an empty path to the PYTHONPATH which resolves files in the current
2400
2594
  # directory, so, depending how pydevd itself is launched, we may need
2401
2595
  # to manually add such an entry to properly resolve modules in the
2402
2596
  # current directory (see: https://github.com/Microsoft/ptvsd/issues/1010).
2403
- if '' not in sys.path:
2404
- sys.path.insert(0, '')
2405
- file, _, entry_point_fn = file.partition(':')
2597
+ if "" not in sys.path:
2598
+ sys.path.insert(0, "")
2599
+ file, _, entry_point_fn = file.partition(":")
2406
2600
  module_name = file
2407
2601
  filename = get_fullname(file)
2408
2602
  if filename is None:
@@ -2420,14 +2614,14 @@ class PyDB(object):
2420
2614
  else:
2421
2615
  file = filename
2422
2616
  mod_dir = os.path.dirname(filename)
2423
- main_py = os.path.join(mod_dir, '__main__.py')
2424
- main_pyc = os.path.join(mod_dir, '__main__.pyc')
2425
- if filename.endswith('__init__.pyc'):
2617
+ main_py = os.path.join(mod_dir, "__main__.py")
2618
+ main_pyc = os.path.join(mod_dir, "__main__.pyc")
2619
+ if filename.endswith("__init__.pyc"):
2426
2620
  if os.path.exists(main_pyc):
2427
2621
  filename = main_pyc
2428
2622
  elif os.path.exists(main_py):
2429
2623
  filename = main_py
2430
- elif filename.endswith('__init__.py'):
2624
+ elif filename.endswith("__init__.py"):
2431
2625
  if os.path.exists(main_pyc) and not os.path.exists(main_py):
2432
2626
  filename = main_pyc
2433
2627
  elif os.path.exists(main_py):
@@ -2436,16 +2630,16 @@ class PyDB(object):
2436
2630
  sys.argv[0] = filename
2437
2631
 
2438
2632
  if os.path.isdir(file):
2439
- new_target = os.path.join(file, '__main__.py')
2633
+ new_target = os.path.join(file, "__main__.py")
2440
2634
  if os.path.isfile(new_target):
2441
2635
  file = new_target
2442
2636
 
2443
2637
  m = None
2444
2638
  if globals is None:
2445
- m = save_main_module(file, 'pydevd')
2639
+ m = save_main_module(file, "pydevd")
2446
2640
  globals = m.__dict__
2447
2641
  try:
2448
- globals['__builtins__'] = __builtins__
2642
+ globals["__builtins__"] = __builtins__
2449
2643
  except NameError:
2450
2644
  pass # Not there on Jython...
2451
2645
 
@@ -2461,7 +2655,7 @@ class PyDB(object):
2461
2655
 
2462
2656
  # I think this is an ugly hack, bug it works (seems to) for the bug that says that sys.path should be the same in
2463
2657
  # debug and run.
2464
- if sys.path[0] != '' and m is not None and m.__file__.startswith(sys.path[0]):
2658
+ if sys.path[0] != "" and m is not None and m.__file__.startswith(sys.path[0]):
2465
2659
  # print >> sys.stderr, 'Deleting: ', sys.path[0]
2466
2660
  del sys.path[0]
2467
2661
 
@@ -2496,7 +2690,7 @@ class PyDB(object):
2496
2690
  except:
2497
2691
  pydev_log.exception("Matplotlib support in debugger failed")
2498
2692
 
2499
- if hasattr(sys, 'exc_clear'):
2693
+ if hasattr(sys, "exc_clear"):
2500
2694
  # we should clean exception information in Python 2, before user's code execution
2501
2695
  sys.exc_clear()
2502
2696
 
@@ -2510,11 +2704,12 @@ class PyDB(object):
2510
2704
  return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
2511
2705
 
2512
2706
  def _exec(self, is_module, entry_point_fn, module_name, file, globals, locals):
2513
- '''
2707
+ """
2514
2708
  This function should have frames tracked by unhandled exceptions (the `_exec` name is important).
2515
- '''
2709
+ """
2710
+ t = threading.current_thread() # Keep in 't' local variable to be accessed afterwards from frame.f_locals.
2516
2711
  if not is_module:
2517
- globals = pydevd_runpy.run_path(file, globals, '__main__')
2712
+ globals = pydevd_runpy.run_path(file, globals, "__main__")
2518
2713
  else:
2519
2714
  # treat ':' as a separator between module and entry point function
2520
2715
  # if there is no entry point we run we same as with -m switch. Otherwise we perform
@@ -2533,8 +2728,10 @@ class PyDB(object):
2533
2728
 
2534
2729
  thread = threading.current_thread()
2535
2730
  from _pydevd_bundle import pydevd_frame_utils
2536
- frame = pydevd_frame_utils.Frame(None, -1, pydevd_frame_utils.FCode("Console",
2537
- os.path.abspath(os.path.dirname(__file__))), globals, globals)
2731
+
2732
+ frame = pydevd_frame_utils.Frame(
2733
+ None, -1, pydevd_frame_utils.FCode("Console", os.path.abspath(os.path.dirname(__file__))), globals, globals
2734
+ )
2538
2735
  thread_id = get_current_thread_id(thread)
2539
2736
  self.add_fake_frame(thread_id, id(frame), frame)
2540
2737
 
@@ -2551,24 +2748,23 @@ class PyDB(object):
2551
2748
 
2552
2749
 
2553
2750
  class IDAPMessagesListener(object):
2554
-
2555
2751
  def before_send(self, message_as_dict):
2556
- '''
2752
+ """
2557
2753
  Called just before a message is sent to the IDE.
2558
2754
 
2559
2755
  :type message_as_dict: dict
2560
- '''
2756
+ """
2561
2757
 
2562
2758
  def after_receive(self, message_as_dict):
2563
- '''
2759
+ """
2564
2760
  Called just after a message is received from the IDE.
2565
2761
 
2566
2762
  :type message_as_dict: dict
2567
- '''
2763
+ """
2568
2764
 
2569
2765
 
2570
2766
  def add_dap_messages_listener(dap_messages_listener):
2571
- '''
2767
+ """
2572
2768
  Adds a listener for the DAP (debug adapter protocol) messages.
2573
2769
 
2574
2770
  :type dap_messages_listener: IDAPMessagesListener
@@ -2577,16 +2773,16 @@ def add_dap_messages_listener(dap_messages_listener):
2577
2773
 
2578
2774
  :note: the notifications are sent from threads and they are not synchronized (so,
2579
2775
  it's possible that a message is sent and received from different threads at the same time).
2580
- '''
2776
+ """
2581
2777
  py_db = get_global_debugger()
2582
2778
  if py_db is None:
2583
- raise AssertionError('PyDB is still not setup.')
2779
+ raise AssertionError("PyDB is still not setup.")
2584
2780
 
2585
2781
  py_db.add_dap_messages_listener(dap_messages_listener)
2586
2782
 
2587
2783
 
2588
2784
  def send_json_message(msg):
2589
- '''
2785
+ """
2590
2786
  API to send some custom json message.
2591
2787
 
2592
2788
  :param dict|pydevd_schema.BaseSchema msg:
@@ -2594,7 +2790,7 @@ def send_json_message(msg):
2594
2790
 
2595
2791
  :return bool:
2596
2792
  True if the message was added to the queue to be sent and False otherwise.
2597
- '''
2793
+ """
2598
2794
  py_db = get_global_debugger()
2599
2795
  if py_db is None:
2600
2796
  return False
@@ -2610,11 +2806,12 @@ def send_json_message(msg):
2610
2806
 
2611
2807
  def enable_qt_support(qt_support_mode):
2612
2808
  from _pydev_bundle import pydev_monkey_qt
2809
+
2613
2810
  pydev_monkey_qt.patch_qt(qt_support_mode)
2614
2811
 
2615
2812
 
2616
2813
  def start_dump_threads_thread(filename_template, timeout, recurrent):
2617
- '''
2814
+ """
2618
2815
  Helper to dump threads after a timeout.
2619
2816
 
2620
2817
  :param filename_template:
@@ -2624,9 +2821,8 @@ def start_dump_threads_thread(filename_template, timeout, recurrent):
2624
2821
  The timeout (in seconds) for the dump.
2625
2822
  :param recurrent:
2626
2823
  If True we'll keep on doing thread dumps.
2627
- '''
2628
- assert filename_template.count('%s') == 1, \
2629
- 'Expected one %%s to appear in: %s' % (filename_template,)
2824
+ """
2825
+ assert filename_template.count("%s") == 1, "Expected one %%s to appear in: %s" % (filename_template,)
2630
2826
 
2631
2827
  def _threads_on_timeout():
2632
2828
  try:
@@ -2637,7 +2833,7 @@ def start_dump_threads_thread(filename_template, timeout, recurrent):
2637
2833
  os.makedirs(os.path.dirname(filename))
2638
2834
  except Exception:
2639
2835
  pass
2640
- with open(filename, 'w') as stream:
2836
+ with open(filename, "w") as stream:
2641
2837
  dump_threads(stream)
2642
2838
  if not recurrent:
2643
2839
  return
@@ -2650,25 +2846,25 @@ def start_dump_threads_thread(filename_template, timeout, recurrent):
2650
2846
 
2651
2847
 
2652
2848
  def dump_threads(stream=None):
2653
- '''
2849
+ """
2654
2850
  Helper to dump thread info (default is printing to stderr).
2655
- '''
2851
+ """
2656
2852
  pydevd_utils.dump_threads(stream)
2657
2853
 
2658
2854
 
2659
2855
  def usage(doExit=0):
2660
- sys.stdout.write('Usage:\n')
2661
- sys.stdout.write('pydevd.py --port N [(--client hostname) | --server] --file executable [file_options]\n')
2856
+ sys.stdout.write("Usage:\n")
2857
+ sys.stdout.write("pydevd.py --port N [(--client hostname) | --server] --file executable [file_options]\n")
2662
2858
  if doExit:
2663
2859
  sys.exit(0)
2664
2860
 
2665
2861
 
2666
2862
  def _init_stdout_redirect():
2667
- pydevd_io.redirect_stream_to_pydb_io_messages(std='stdout')
2863
+ pydevd_io.redirect_stream_to_pydb_io_messages(std="stdout")
2668
2864
 
2669
2865
 
2670
2866
  def _init_stderr_redirect():
2671
- pydevd_io.redirect_stream_to_pydb_io_messages(std='stderr')
2867
+ pydevd_io.redirect_stream_to_pydb_io_messages(std="stderr")
2672
2868
 
2673
2869
 
2674
2870
  def _enable_attach(
@@ -2678,8 +2874,8 @@ def _enable_attach(
2678
2874
  patch_multiprocessing=False,
2679
2875
  access_token=None,
2680
2876
  client_access_token=None,
2681
- ):
2682
- '''
2877
+ ):
2878
+ """
2683
2879
  Starts accepting connections at the given host/port. The debugger will not be initialized nor
2684
2880
  configured, it'll only start accepting connections (and will have the tracing setup in this
2685
2881
  thread).
@@ -2688,13 +2884,13 @@ def _enable_attach(
2688
2884
 
2689
2885
  :param address: (host, port)
2690
2886
  :type address: tuple(str, int)
2691
- '''
2887
+ """
2692
2888
  host = address[0]
2693
2889
  port = int(address[1])
2694
2890
 
2695
2891
  if SetupHolder.setup is not None:
2696
- if port != SetupHolder.setup['port']:
2697
- raise AssertionError('Unable to listen in port: %s (already listening in port: %s)' % (port, SetupHolder.setup['port']))
2892
+ if port != SetupHolder.setup["port"]:
2893
+ raise AssertionError("Unable to listen in port: %s (already listening in port: %s)" % (port, SetupHolder.setup["port"]))
2698
2894
  settrace(
2699
2895
  host=host,
2700
2896
  port=port,
@@ -2714,30 +2910,30 @@ def _enable_attach(
2714
2910
 
2715
2911
 
2716
2912
  def _wait_for_attach(cancel=None):
2717
- '''
2913
+ """
2718
2914
  Meant to be called after _enable_attach() -- the current thread will only unblock after a
2719
2915
  connection is in place and the DAP (Debug Adapter Protocol) sends the ConfigurationDone
2720
2916
  request.
2721
- '''
2917
+ """
2722
2918
  py_db = get_global_debugger()
2723
2919
  if py_db is None:
2724
- raise AssertionError('Debugger still not created. Please use _enable_attach() before using _wait_for_attach().')
2920
+ raise AssertionError("Debugger still not created. Please use _enable_attach() before using _wait_for_attach().")
2725
2921
 
2726
2922
  py_db.block_until_configuration_done(cancel=cancel)
2727
2923
 
2728
2924
 
2729
2925
  def _is_attached():
2730
- '''
2926
+ """
2731
2927
  Can be called any time to check if the connection was established and the DAP (Debug Adapter Protocol) has sent
2732
2928
  the ConfigurationDone request.
2733
- '''
2929
+ """
2734
2930
  py_db = get_global_debugger()
2735
2931
  return (py_db is not None) and py_db.is_attached()
2736
2932
 
2737
2933
 
2738
- #=======================================================================================================================
2934
+ # =======================================================================================================================
2739
2935
  # settrace
2740
- #=======================================================================================================================
2936
+ # =======================================================================================================================
2741
2937
  def settrace(
2742
2938
  host=None,
2743
2939
  stdout_to_server=False,
@@ -2745,7 +2941,7 @@ def settrace(
2745
2941
  port=5678,
2746
2942
  suspend=True,
2747
2943
  trace_only_current_thread=False,
2748
- overwrite_prev_trace=False,
2944
+ overwrite_prev_trace=False, # Deprecated
2749
2945
  patch_multiprocessing=False,
2750
2946
  stop_at_frame=None,
2751
2947
  block_until_connected=True,
@@ -2755,9 +2951,10 @@ def settrace(
2755
2951
  access_token=None,
2756
2952
  client_access_token=None,
2757
2953
  notify_stdin=True,
2758
- **kwargs
2759
- ):
2760
- '''Sets the tracing function with the pydev debug function and initializes needed facilities.
2954
+ protocol=None,
2955
+ **kwargs,
2956
+ ):
2957
+ """Sets the tracing function with the pydev debug function and initializes needed facilities.
2761
2958
 
2762
2959
  :param host: the user may specify another host, if the debug server is not in the same machine (default is the local
2763
2960
  host)
@@ -2809,13 +3006,20 @@ def settrace(
2809
3006
  as an input to the process or as a command to be evaluated.
2810
3007
  Note that parallel-python has issues with this (because it tries to assert that sys.stdin
2811
3008
  is of a given type instead of just checking that it has what it needs).
2812
- '''
2813
3009
 
2814
- stdout_to_server = stdout_to_server or kwargs.get('stdoutToServer', False) # Backward compatibility
2815
- stderr_to_server = stderr_to_server or kwargs.get('stderrToServer', False) # Backward compatibility
3010
+ :param protocol:
3011
+ When using in Eclipse the protocol should not be passed, but when used in VSCode
3012
+ or some other IDE/editor that accepts the Debug Adapter Protocol then 'dap' should
3013
+ be passed.
3014
+ """
3015
+ if protocol and protocol.lower() == "dap":
3016
+ pydevd_defaults.PydevdCustomization.DEFAULT_PROTOCOL = pydevd_constants.HTTP_JSON_PROTOCOL
3017
+
3018
+ stdout_to_server = stdout_to_server or kwargs.get("stdoutToServer", False) # Backward compatibility
3019
+ stderr_to_server = stderr_to_server or kwargs.get("stderrToServer", False) # Backward compatibility
2816
3020
 
2817
3021
  # Internal use (may be used to set the setup info directly for subprocesess).
2818
- __setup_holder__ = kwargs.get('__setup_holder__')
3022
+ __setup_holder__ = kwargs.get("__setup_holder__")
2819
3023
 
2820
3024
  with _set_trace_lock:
2821
3025
  _locked_settrace(
@@ -2858,7 +3062,7 @@ def _locked_settrace(
2858
3062
  client_access_token,
2859
3063
  __setup_holder__,
2860
3064
  notify_stdin,
2861
- ):
3065
+ ):
2862
3066
  if patch_multiprocessing:
2863
3067
  try:
2864
3068
  from _pydev_bundle import pydev_monkey
@@ -2869,6 +3073,7 @@ def _locked_settrace(
2869
3073
 
2870
3074
  if host is None:
2871
3075
  from _pydev_bundle import pydev_localhost
3076
+
2872
3077
  host = pydev_localhost.get_localhost()
2873
3078
 
2874
3079
  global _global_redirect_stdout_to_server
@@ -2883,20 +3088,20 @@ def _locked_settrace(
2883
3088
 
2884
3089
  if SetupHolder.setup is None:
2885
3090
  setup = {
2886
- 'client': host, # dispatch expects client to be set to the host address when server is False
2887
- 'server': False,
2888
- 'port': int(port),
2889
- 'multiprocess': patch_multiprocessing,
2890
- 'skip-notify-stdin': not notify_stdin,
3091
+ "client": host, # dispatch expects client to be set to the host address when server is False
3092
+ "server": False,
3093
+ "port": int(port),
3094
+ "multiprocess": patch_multiprocessing,
3095
+ "skip-notify-stdin": not notify_stdin,
2891
3096
  }
2892
3097
  SetupHolder.setup = setup
2893
3098
 
2894
3099
  if access_token is not None:
2895
3100
  py_db.authentication.access_token = access_token
2896
- SetupHolder.setup['access-token'] = access_token
3101
+ SetupHolder.setup["access-token"] = access_token
2897
3102
  if client_access_token is not None:
2898
3103
  py_db.authentication.client_access_token = client_access_token
2899
- SetupHolder.setup['client-access-token'] = client_access_token
3104
+ SetupHolder.setup["client-access-token"] = client_access_token
2900
3105
 
2901
3106
  if block_until_connected:
2902
3107
  py_db.connect(host, port) # Note: connect can raise error.
@@ -2946,11 +3151,11 @@ def _locked_settrace(
2946
3151
  # As this is the first connection, also set tracing for any untraced threads
2947
3152
  py_db.set_tracing_for_untraced_contexts()
2948
3153
 
2949
- py_db.set_trace_for_frame_and_parents(get_frame().f_back)
3154
+ py_db.set_trace_for_frame_and_parents(t.ident, get_frame().f_back)
2950
3155
 
2951
3156
  with CustomFramesContainer.custom_frames_lock: # @UndefinedVariable
2952
3157
  for _frameId, custom_frame in CustomFramesContainer.custom_frames.items():
2953
- py_db.set_trace_for_frame_and_parents(custom_frame.frame)
3158
+ py_db.set_trace_for_frame_and_parents(None, custom_frame.frame)
2954
3159
 
2955
3160
  else:
2956
3161
  # ok, we're already in debug mode, with all set, so, let's just set the break
@@ -2959,9 +3164,8 @@ def _locked_settrace(
2959
3164
  if client_access_token is not None:
2960
3165
  py_db.authentication.client_access_token = client_access_token
2961
3166
 
2962
- py_db.set_trace_for_frame_and_parents(get_frame().f_back)
2963
-
2964
3167
  t = threadingCurrentThread()
3168
+ py_db.set_trace_for_frame_and_parents(t.ident, get_frame().f_back)
2965
3169
  additional_info = set_additional_thread_info(t)
2966
3170
 
2967
3171
  if trace_only_current_thread:
@@ -2973,30 +3177,42 @@ def _locked_settrace(
2973
3177
 
2974
3178
  # Suspend as the last thing after all tracing is in place.
2975
3179
  if suspend:
3180
+ additional_info.pydev_original_step_cmd = CMD_SET_BREAK
2976
3181
  if stop_at_frame is not None:
2977
3182
  # If the step was set we have to go to run state and
2978
3183
  # set the proper frame for it to stop.
2979
3184
  additional_info.pydev_state = STATE_RUN
2980
- additional_info.pydev_original_step_cmd = CMD_STEP_OVER
2981
3185
  additional_info.pydev_step_cmd = CMD_STEP_OVER
2982
3186
  additional_info.pydev_step_stop = stop_at_frame
2983
3187
  additional_info.suspend_type = PYTHON_SUSPEND
3188
+ additional_info.update_stepping_info()
3189
+ if PYDEVD_USE_SYS_MONITORING:
3190
+ pydevd_sys_monitoring.update_monitor_events(suspend_requested=True)
3191
+ py_db.set_trace_for_frame_and_parents(t.ident, stop_at_frame)
2984
3192
  else:
2985
3193
  # Ask to break as soon as possible.
2986
- py_db.set_suspend(t, CMD_SET_BREAK)
3194
+ py_db.set_suspend(t, CMD_SET_BREAK, suspend_requested=True)
3195
+ py_db.set_trace_for_frame_and_parents(t.ident, get_frame().f_back)
3196
+
3197
+ if PYDEVD_USE_SYS_MONITORING:
3198
+ pydevd_sys_monitoring.restart_events()
2987
3199
 
2988
3200
 
2989
3201
  def stoptrace():
2990
3202
  pydev_log.debug("pydevd.stoptrace()")
2991
3203
  pydevd_tracing.restore_sys_set_trace_func()
2992
- sys.settrace(None)
2993
- try:
2994
- # not available in jython!
2995
- threading.settrace(None) # for all future threads
2996
- except:
2997
- pass
3204
+ if PYDEVD_USE_SYS_MONITORING:
3205
+ pydevd_sys_monitoring.stop_monitoring(all_threads=True)
3206
+ else:
3207
+ sys.settrace(None)
3208
+ try:
3209
+ # not available in jython!
3210
+ threading.settrace(None) # for all future threads
3211
+ except:
3212
+ pass
2998
3213
 
2999
3214
  from _pydev_bundle.pydev_monkey import undo_patch_thread_modules
3215
+
3000
3216
  undo_patch_thread_modules()
3001
3217
 
3002
3218
  # Either or both standard streams can be closed at this point,
@@ -3017,7 +3233,6 @@ def stoptrace():
3017
3233
 
3018
3234
 
3019
3235
  class Dispatcher(object):
3020
-
3021
3236
  def __init__(self):
3022
3237
  self.port = None
3023
3238
 
@@ -3037,7 +3252,6 @@ class Dispatcher(object):
3037
3252
 
3038
3253
 
3039
3254
  class DispatchReader(ReaderThread):
3040
-
3041
3255
  def __init__(self, dispatcher):
3042
3256
  self.dispatcher = dispatcher
3043
3257
 
@@ -3081,8 +3295,8 @@ DISPATCH_APPROACH = DISPATCH_APPROACH_NEW_CONNECTION
3081
3295
 
3082
3296
  def dispatch():
3083
3297
  setup = SetupHolder.setup
3084
- host = setup['client']
3085
- port = setup['port']
3298
+ host = setup["client"]
3299
+ port = setup["port"]
3086
3300
  if DISPATCH_APPROACH == DISPATCH_APPROACH_EXISTING_CONNECTION:
3087
3301
  dispatcher = Dispatcher()
3088
3302
  try:
@@ -3094,10 +3308,11 @@ def dispatch():
3094
3308
 
3095
3309
 
3096
3310
  def settrace_forked(setup_tracing=True):
3097
- '''
3311
+ """
3098
3312
  When creating a fork from a process in the debugger, we need to reset the whole debugger environment!
3099
- '''
3313
+ """
3100
3314
  from _pydevd_bundle.pydevd_constants import GlobalDebuggerHolder
3315
+
3101
3316
  py_db = GlobalDebuggerHolder.global_dbg
3102
3317
  if py_db is not None:
3103
3318
  py_db.created_pydb_daemon_threads = {} # Just making sure we won't touch those (paused) threads.
@@ -3114,14 +3329,16 @@ def settrace_forked(setup_tracing=True):
3114
3329
  # i.e.: Get the ppid at this point as it just changed.
3115
3330
  # If we later do an exec() it should remain the same ppid.
3116
3331
  setup[pydevd_constants.ARGUMENT_PPID] = PyDevdAPI().get_ppid()
3117
- access_token = setup.get('access-token')
3118
- client_access_token = setup.get('client-access-token')
3332
+ access_token = setup.get("access-token")
3333
+ client_access_token = setup.get("client-access-token")
3119
3334
 
3120
3335
  if setup_tracing:
3121
3336
  from _pydevd_frame_eval.pydevd_frame_eval_main import clear_thread_local_info
3337
+
3122
3338
  host, port = dispatch()
3123
3339
 
3124
3340
  import pydevd_tracing
3341
+
3125
3342
  pydevd_tracing.restore_sys_set_trace_func()
3126
3343
 
3127
3344
  if setup_tracing:
@@ -3132,20 +3349,20 @@ def settrace_forked(setup_tracing=True):
3132
3349
  clear_thread_local_info()
3133
3350
 
3134
3351
  settrace(
3135
- host,
3136
- port=port,
3137
- suspend=False,
3138
- trace_only_current_thread=False,
3139
- overwrite_prev_trace=True,
3140
- patch_multiprocessing=True,
3141
- access_token=access_token,
3142
- client_access_token=client_access_token,
3352
+ host,
3353
+ port=port,
3354
+ suspend=False,
3355
+ trace_only_current_thread=False,
3356
+ overwrite_prev_trace=True,
3357
+ patch_multiprocessing=True,
3358
+ access_token=access_token,
3359
+ client_access_token=client_access_token,
3143
3360
  )
3144
3361
 
3145
3362
 
3146
3363
  @contextmanager
3147
3364
  def skip_subprocess_arg_patch():
3148
- '''
3365
+ """
3149
3366
  May be used to skip the monkey-patching that pydevd does to
3150
3367
  skip changing arguments to embed the debugger into child processes.
3151
3368
 
@@ -3153,14 +3370,15 @@ def skip_subprocess_arg_patch():
3153
3370
 
3154
3371
  with pydevd.skip_subprocess_arg_patch():
3155
3372
  subprocess.call(...)
3156
- '''
3373
+ """
3157
3374
  from _pydev_bundle import pydev_monkey
3375
+
3158
3376
  with pydev_monkey.skip_subprocess_arg_patch():
3159
3377
  yield
3160
3378
 
3161
3379
 
3162
3380
  def add_dont_terminate_child_pid(pid):
3163
- '''
3381
+ """
3164
3382
  May be used to ask pydevd to skip the termination of some process
3165
3383
  when it's asked to terminate (debug adapter protocol only).
3166
3384
 
@@ -3171,14 +3389,13 @@ def add_dont_terminate_child_pid(pid):
3171
3389
 
3172
3390
  process = subprocess.Popen(...)
3173
3391
  pydevd.add_dont_terminate_child_pid(process.pid)
3174
- '''
3392
+ """
3175
3393
  py_db = get_global_debugger()
3176
3394
  if py_db is not None:
3177
3395
  py_db.dont_terminate_child_pids.add(pid)
3178
3396
 
3179
3397
 
3180
3398
  class SetupHolder:
3181
-
3182
3399
  setup = None
3183
3400
 
3184
3401
 
@@ -3187,21 +3404,22 @@ def apply_debugger_options(setup_options):
3187
3404
 
3188
3405
  :type setup_options: dict[str, bool]
3189
3406
  """
3190
- default_options = {'save-signatures': False, 'qt-support': ''}
3407
+ default_options = {"save-signatures": False, "qt-support": ""}
3191
3408
  default_options.update(setup_options)
3192
3409
  setup_options = default_options
3193
3410
 
3194
3411
  debugger = get_global_debugger()
3195
- if setup_options['save-signatures']:
3412
+ if setup_options["save-signatures"]:
3196
3413
  if pydevd_vm_type.get_vm_type() == pydevd_vm_type.PydevdVmType.JYTHON:
3197
3414
  sys.stderr.write("Collecting run-time type information is not supported for Jython\n")
3198
3415
  else:
3199
3416
  # Only import it if we're going to use it!
3200
3417
  from _pydevd_bundle.pydevd_signature import SignatureFactory
3418
+
3201
3419
  debugger.signature_factory = SignatureFactory()
3202
3420
 
3203
- if setup_options['qt-support']:
3204
- enable_qt_support(setup_options['qt-support'])
3421
+ if setup_options["qt-support"]:
3422
+ enable_qt_support(setup_options["qt-support"])
3205
3423
 
3206
3424
 
3207
3425
  @call_only_once
@@ -3210,10 +3428,10 @@ def patch_stdin():
3210
3428
 
3211
3429
 
3212
3430
  def _internal_patch_stdin(py_db=None, sys=None, getpass_mod=None):
3213
- '''
3431
+ """
3214
3432
  Note: don't use this function directly, use `patch_stdin()` instead.
3215
3433
  (this function is only meant to be used on test-cases to avoid patching the actual globals).
3216
- '''
3434
+ """
3217
3435
  # Patch stdin so that we notify when readline() is called.
3218
3436
  original_sys_stdin = sys.stdin
3219
3437
  debug_console_stdin = DebugConsoleStdIn(py_db, original_sys_stdin)
@@ -3234,6 +3452,7 @@ def _internal_patch_stdin(py_db=None, sys=None, getpass_mod=None):
3234
3452
 
3235
3453
  getpass_mod.getpass = getpass
3236
3454
 
3455
+
3237
3456
  # Dispatch on_debugger_modules_loaded here, after all primary py_db modules are loaded
3238
3457
 
3239
3458
 
@@ -3241,8 +3460,8 @@ for handler in pydevd_extension_utils.extensions_of_type(DebuggerEventHandler):
3241
3460
  handler.on_debugger_modules_loaded(debugger_version=__version__)
3242
3461
 
3243
3462
 
3244
- def log_to(log_file:str, log_level=3) -> None:
3245
- '''
3463
+ def log_to(log_file: str, log_level=3) -> None:
3464
+ """
3246
3465
  In pydevd it's possible to log by setting the following environment variables:
3247
3466
 
3248
3467
  PYDEVD_DEBUG=1 (sets the default log level to 3 along with other default options)
@@ -3256,7 +3475,7 @@ def log_to(log_file:str, log_level=3) -> None:
3256
3475
  pydevd is still doing its imports and not just after this method is called, but on
3257
3476
  cases where this is hard to do this function may be called to set the tracing after
3258
3477
  pydevd itself is already imported.
3259
- '''
3478
+ """
3260
3479
  pydev_log.log_to(log_file, log_level)
3261
3480
 
3262
3481
 
@@ -3268,45 +3487,45 @@ def _log_initial_info():
3268
3487
  pydev_log.debug("Using gevent mode: %s / imported gevent module support: %s", SUPPORT_GEVENT, bool(pydevd_gevent_integration))
3269
3488
 
3270
3489
 
3271
- def config(protocol='', debug_mode='', preimport=''):
3272
- pydev_log.debug('Config: protocol: %s, debug_mode: %s, preimport: %s', protocol, debug_mode, preimport)
3490
+ def config(protocol="", debug_mode="", preimport=""):
3491
+ pydev_log.debug("Config: protocol: %s, debug_mode: %s, preimport: %s", protocol, debug_mode, preimport)
3273
3492
  PydevdCustomization.DEFAULT_PROTOCOL = protocol
3274
3493
  PydevdCustomization.DEBUG_MODE = debug_mode
3275
3494
  PydevdCustomization.PREIMPORT = preimport
3276
3495
 
3277
3496
 
3278
- #=======================================================================================================================
3497
+ # =======================================================================================================================
3279
3498
  # main
3280
- #=======================================================================================================================
3499
+ # =======================================================================================================================
3281
3500
  def main():
3282
-
3283
3501
  # parse the command line. --file is our last argument that is required
3284
3502
  _log_initial_info()
3285
3503
  original_argv = sys.argv[:]
3286
3504
  try:
3287
3505
  from _pydevd_bundle.pydevd_command_line_handling import process_command_line
3506
+
3288
3507
  setup = process_command_line(sys.argv)
3289
3508
  SetupHolder.setup = setup
3290
3509
  except ValueError:
3291
3510
  pydev_log.exception()
3292
3511
  usage(1)
3293
3512
 
3294
- preimport = setup.get('preimport')
3513
+ preimport = setup.get("preimport")
3295
3514
  if preimport:
3296
3515
  pydevd_defaults.PydevdCustomization.PREIMPORT = preimport
3297
3516
 
3298
- debug_mode = setup.get('debug-mode')
3517
+ debug_mode = setup.get("debug-mode")
3299
3518
  if debug_mode:
3300
3519
  pydevd_defaults.PydevdCustomization.DEBUG_MODE = debug_mode
3301
3520
 
3302
- log_trace_level = setup.get('log-level')
3521
+ log_trace_level = setup.get("log-level")
3303
3522
 
3304
3523
  # Note: the logging info could've been changed (this would happen if this is a
3305
3524
  # subprocess and the value in the environment variable does not match the value in the
3306
3525
  # argument because the user used `pydevd.log_to` instead of supplying the environment
3307
3526
  # variable). If this is the case, update the logging info and re-log some information
3308
3527
  # in the new target.
3309
- new_debug_file = setup.get('log-file')
3528
+ new_debug_file = setup.get("log-file")
3310
3529
  if new_debug_file and DebugInfoHolder.PYDEVD_DEBUG_FILE != new_debug_file:
3311
3530
  # The debug file can't be set directly, we need to use log_to() so that the a
3312
3531
  # new stream is actually created for the new file.
@@ -3316,23 +3535,23 @@ def main():
3316
3535
  elif log_trace_level is not None:
3317
3536
  # The log file was not specified
3318
3537
  DebugInfoHolder.DEBUG_TRACE_LEVEL = log_trace_level
3319
- pydev_log.debug('Original sys.argv: %s', original_argv)
3538
+ pydev_log.debug("Original sys.argv: %s", original_argv)
3320
3539
 
3321
- if setup['print-in-debugger-startup']:
3540
+ if setup["print-in-debugger-startup"]:
3322
3541
  try:
3323
- pid = ' (pid: %s)' % os.getpid()
3542
+ pid = " (pid: %s)" % os.getpid()
3324
3543
  except:
3325
- pid = ''
3544
+ pid = ""
3326
3545
  sys.stderr.write("pydev debugger: starting%s\n" % pid)
3327
3546
 
3328
- pydev_log.debug("Executing file %s", setup['file'])
3547
+ pydev_log.debug("Executing file %s", setup["file"])
3329
3548
  pydev_log.debug("arguments: %s", (sys.argv,))
3330
3549
 
3331
- pydevd_vm_type.setup_type(setup.get('vm_type', None))
3550
+ pydevd_vm_type.setup_type(setup.get("vm_type", None))
3332
3551
 
3333
- port = setup['port']
3334
- host = setup['client']
3335
- f = setup['file']
3552
+ port = setup["port"]
3553
+ host = setup["client"]
3554
+ f = setup["file"]
3336
3555
  fix_app_engine_debug = False
3337
3556
 
3338
3557
  debugger = get_global_debugger()
@@ -3344,10 +3563,10 @@ def main():
3344
3563
  except:
3345
3564
  pass # Not usable on jython 2.1
3346
3565
  else:
3347
- if setup['multiprocess']: # PyDev
3566
+ if setup["multiprocess"]: # PyDev
3348
3567
  pydev_monkey.patch_new_process_functions()
3349
3568
 
3350
- elif setup['multiproc']: # PyCharm
3569
+ elif setup["multiproc"]: # PyCharm
3351
3570
  pydev_log.debug("Started in multiproc mode\n")
3352
3571
  global DISPATCH_APPROACH
3353
3572
  DISPATCH_APPROACH = DISPATCH_APPROACH_EXISTING_CONNECTION
@@ -3375,20 +3594,20 @@ def main():
3375
3594
  pydev_log.exception("Error patching process functions.")
3376
3595
 
3377
3596
  # Only do this patching if we're not running with multiprocess turned on.
3378
- if f.find('dev_appserver.py') != -1:
3379
- if os.path.basename(f).startswith('dev_appserver.py'):
3597
+ if f.find("dev_appserver.py") != -1:
3598
+ if os.path.basename(f).startswith("dev_appserver.py"):
3380
3599
  appserver_dir = os.path.dirname(f)
3381
- version_file = os.path.join(appserver_dir, 'VERSION')
3600
+ version_file = os.path.join(appserver_dir, "VERSION")
3382
3601
  if os.path.exists(version_file):
3383
3602
  try:
3384
- stream = open(version_file, 'r')
3603
+ stream = open(version_file, "r")
3385
3604
  try:
3386
3605
  for line in stream.read().splitlines():
3387
3606
  line = line.strip()
3388
- if line.startswith('release:'):
3607
+ if line.startswith("release:"):
3389
3608
  line = line[8:].strip()
3390
- version = line.replace('"', '')
3391
- version = version.split('.')
3609
+ version = line.replace('"', "")
3610
+ version = version.split(".")
3392
3611
  if int(version[0]) > 1:
3393
3612
  fix_app_engine_debug = True
3394
3613
 
@@ -3417,17 +3636,18 @@ def main():
3417
3636
  #
3418
3637
  # itself to be able to benefit from seeing the tasklets created before the remote debugger is attached.
3419
3638
  from _pydevd_bundle import pydevd_stackless
3639
+
3420
3640
  pydevd_stackless.patch_stackless()
3421
3641
  except:
3422
3642
  # It's ok not having stackless there...
3423
3643
  try:
3424
- if hasattr(sys, 'exc_clear'):
3644
+ if hasattr(sys, "exc_clear"):
3425
3645
  sys.exc_clear() # the exception information should be cleaned in Python 2
3426
3646
  except:
3427
3647
  pass
3428
3648
 
3429
- is_module = setup['module']
3430
- if not setup['skip-notify-stdin']:
3649
+ is_module = setup["module"]
3650
+ if not setup["skip-notify-stdin"]:
3431
3651
  patch_stdin()
3432
3652
 
3433
3653
  if setup[pydevd_constants.ARGUMENT_JSON_PROTOCOL]:
@@ -3442,32 +3662,36 @@ def main():
3442
3662
  elif setup[pydevd_constants.ARGUMENT_QUOTED_LINE_PROTOCOL]:
3443
3663
  PyDevdAPI().set_protocol(debugger, 0, pydevd_constants.QUOTED_LINE_PROTOCOL)
3444
3664
 
3445
- access_token = setup['access-token']
3665
+ access_token = setup["access-token"]
3446
3666
  if access_token:
3447
3667
  debugger.authentication.access_token = access_token
3448
3668
 
3449
- client_access_token = setup['client-access-token']
3669
+ client_access_token = setup["client-access-token"]
3450
3670
  if client_access_token:
3451
3671
  debugger.authentication.client_access_token = client_access_token
3452
3672
 
3453
3673
  if fix_app_engine_debug:
3454
3674
  sys.stderr.write("pydev debugger: google app engine integration enabled\n")
3455
3675
  curr_dir = os.path.dirname(__file__)
3456
- app_engine_startup_file = os.path.join(curr_dir, 'pydev_app_engine_debug_startup.py')
3676
+ app_engine_startup_file = os.path.join(curr_dir, "pydev_app_engine_debug_startup.py")
3457
3677
 
3458
- sys.argv.insert(1, '--python_startup_script=' + app_engine_startup_file)
3678
+ sys.argv.insert(1, "--python_startup_script=" + app_engine_startup_file)
3459
3679
  import json
3460
- setup['pydevd'] = __file__
3461
- sys.argv.insert(2, '--python_startup_args=%s' % json.dumps(setup),)
3462
- sys.argv.insert(3, '--automatic_restart=no')
3463
- sys.argv.insert(4, '--max_module_instances=1')
3680
+
3681
+ setup["pydevd"] = __file__
3682
+ sys.argv.insert(
3683
+ 2,
3684
+ "--python_startup_args=%s" % json.dumps(setup),
3685
+ )
3686
+ sys.argv.insert(3, "--automatic_restart=no")
3687
+ sys.argv.insert(4, "--max_module_instances=1")
3464
3688
 
3465
3689
  # Run the dev_appserver
3466
- debugger.run(setup['file'], None, None, is_module, set_trace=False)
3690
+ debugger.run(setup["file"], None, None, is_module, set_trace=False)
3467
3691
  else:
3468
- if setup['save-threading']:
3692
+ if setup["save-threading"]:
3469
3693
  debugger.thread_analyser = ThreadingLogger()
3470
- if setup['save-asyncio']:
3694
+ if setup["save-asyncio"]:
3471
3695
  debugger.asyncio_analyser = AsyncioLogger()
3472
3696
 
3473
3697
  apply_debugger_options(setup)
@@ -3479,11 +3703,11 @@ def main():
3479
3703
  pydev_log.exception()
3480
3704
  sys.exit(1)
3481
3705
 
3482
- globals = debugger.run(setup['file'], None, None, is_module)
3706
+ globals = debugger.run(setup["file"], None, None, is_module)
3483
3707
 
3484
- if setup['cmd-line']:
3708
+ if setup["cmd-line"]:
3485
3709
  debugger.wait_for_commands(globals)
3486
3710
 
3487
3711
 
3488
- if __name__ == '__main__':
3712
+ if __name__ == "__main__":
3489
3713
  main()