File tree Expand file tree Collapse file tree 4 files changed +12
-17
lines changed Expand file tree Collapse file tree 4 files changed +12
-17
lines changed Original file line number Diff line number Diff line change 21
21
import threading
22
22
23
23
from debugpy .common import json , log , util
24
- from debugpy .common .util import skip_trace
24
+ from debugpy .common .util import hide_thread_from_debugger
25
25
26
26
27
27
class JsonIOError (IOError ):
@@ -1150,10 +1150,8 @@ def start(self):
1150
1150
target = self ._parse_incoming_messages , name = f"{ self } message parser"
1151
1151
)
1152
1152
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
1157
1155
self ._parser_thread .start ()
1158
1156
1159
1157
def wait (self ):
Original file line number Diff line number Diff line change 7
7
import threading
8
8
9
9
from debugpy .common import log
10
- from debugpy .common .util import skip_trace
10
+ from debugpy .common .util import hide_thread_from_debugger
11
11
12
12
13
13
def create_server (host , port = 0 , backlog = socket .SOMAXCONN , timeout = None ):
@@ -115,10 +115,8 @@ def accept_worker():
115
115
handler (sock )
116
116
117
117
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 )
122
120
thread .start ()
123
121
124
122
return listener
Original file line number Diff line number Diff line change @@ -150,16 +150,15 @@ def srcnameof(obj):
150
150
return name
151
151
152
152
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 ."""
155
155
return "DEBUGPY_TRACE_DEBUGPY" not in os .environ
156
156
157
157
158
- def disable_tracing (thread ):
158
+ def hide_thread_from_debugger (thread ):
159
159
"""Disables tracing for the given thread if DEBUGPY_TRACE_DEBUGPY is not set.
160
160
DEBUGPY_TRACE_DEBUGPY is used to debug debugpy with debugpy
161
161
"""
162
- if skip_trace ():
162
+ if hide_debugpy_internals ():
163
163
thread .pydev_do_not_trace = True
164
164
thread .is_pydev_daemon_thread = True
165
- thread .daemon = True
Original file line number Diff line number Diff line change 14
14
from debugpy .common import json , log , sockets
15
15
from _pydevd_bundle .pydevd_constants import get_global_debugger
16
16
from pydevd_file_utils import absolute_path
17
- from debugpy .common .util import skip_trace
17
+ from debugpy .common .util import hide_debugpy_internals
18
18
19
19
_tls = threading .local ()
20
20
@@ -129,7 +129,7 @@ def debug(address, **kwargs):
129
129
"patch_multiprocessing" : _config .get ("subProcess" , True ),
130
130
}
131
131
132
- if skip_trace ():
132
+ if hide_debugpy_internals ():
133
133
debugpy_path = os .path .dirname (absolute_path (debugpy .__file__ ))
134
134
settrace_kwargs ["dont_trace_start_patterns" ] = (debugpy_path ,)
135
135
settrace_kwargs ["dont_trace_end_patterns" ] = (str ("debugpy_launcher.py" ),)
You can’t perform that action at this time.
0 commit comments