File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import threading
2222
2323from debugpy .common import json , log , util
24- from debugpy .common .util import skip_trace
24+ from debugpy .common .util import hide_thread_from_debugger
2525
2626
2727class JsonIOError (IOError ):
@@ -1150,10 +1150,8 @@ def start(self):
11501150 target = self ._parse_incoming_messages , name = f"{ self } message parser"
11511151 )
11521152
1153- if skip_trace ():
1154- self ._parser_thread .pydev_do_not_trace = True
1155- self ._parser_thread .is_pydev_daemon_thread = True
1156- self ._parser_thread .daemon = True
1153+ hide_thread_from_debugger (self ._parser_thread )
1154+ self ._parser_thread .daemon = True
11571155 self ._parser_thread .start ()
11581156
11591157 def wait (self ):
Original file line number Diff line number Diff line change 77import threading
88
99from debugpy .common import log
10- from debugpy .common .util import skip_trace
10+ from debugpy .common .util import hide_thread_from_debugger
1111
1212
1313def create_server (host , port = 0 , backlog = socket .SOMAXCONN , timeout = None ):
@@ -115,10 +115,8 @@ def accept_worker():
115115 handler (sock )
116116
117117 thread = threading .Thread (target = accept_worker )
118- if skip_trace ():
119- thread .daemon = True
120- thread .pydev_do_not_trace = True
121- thread .is_pydev_daemon_thread = True
118+ thread .daemon = True
119+ hide_thread_from_debugger (thread )
122120 thread .start ()
123121
124122 return listener
Original file line number Diff line number Diff line change @@ -150,16 +150,15 @@ def srcnameof(obj):
150150 return name
151151
152152
153- def skip_trace ():
154- """Returns True if tracing should be skipped for the current thread ."""
153+ def hide_debugpy_internals ():
154+ """Returns True if the caller should hide something from debugpy ."""
155155 return "DEBUGPY_TRACE_DEBUGPY" not in os .environ
156156
157157
158- def disable_tracing (thread ):
158+ def hide_thread_from_debugger (thread ):
159159 """Disables tracing for the given thread if DEBUGPY_TRACE_DEBUGPY is not set.
160160 DEBUGPY_TRACE_DEBUGPY is used to debug debugpy with debugpy
161161 """
162- if skip_trace ():
162+ if hide_debugpy_internals ():
163163 thread .pydev_do_not_trace = True
164164 thread .is_pydev_daemon_thread = True
165- thread .daemon = True
Original file line number Diff line number Diff line change 1414from debugpy .common import json , log , sockets
1515from _pydevd_bundle .pydevd_constants import get_global_debugger
1616from pydevd_file_utils import absolute_path
17- from debugpy .common .util import skip_trace
17+ from debugpy .common .util import hide_debugpy_internals
1818
1919_tls = threading .local ()
2020
@@ -129,7 +129,7 @@ def debug(address, **kwargs):
129129 "patch_multiprocessing" : _config .get ("subProcess" , True ),
130130 }
131131
132- if skip_trace ():
132+ if hide_debugpy_internals ():
133133 debugpy_path = os .path .dirname (absolute_path (debugpy .__file__ ))
134134 settrace_kwargs ["dont_trace_start_patterns" ] = (debugpy_path ,)
135135 settrace_kwargs ["dont_trace_end_patterns" ] = (str ("debugpy_launcher.py" ),)
You can’t perform that action at this time.
0 commit comments