From 21636ad5464231b48b2f885874fdaf24f5f01e35 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 9 Feb 2018 13:45:50 -0800 Subject: [PATCH 1/2] Removes ptvsd threads from the threads list. --- ptvsd/wrapper.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ptvsd/wrapper.py b/ptvsd/wrapper.py index adbf21f1..61318a92 100644 --- a/ptvsd/wrapper.py +++ b/ptvsd/wrapper.py @@ -473,7 +473,7 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel): name = unquote(xthread['name']) except KeyError: name = None - if not (name and name.startswith('pydevd.')): + if not (name and (name.startswith('pydevd.') or name.startswith('ptvsd.'))): threads.append({'id': tid, 'name': name}) self.send_response(request, threads=threads) @@ -724,7 +724,12 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel): # TODO: docstring xml = untangle.parse(args).xml tid = self.thread_map.to_vscode(xml.thread['id']) - self.send_event('thread', reason='started', threadId=tid) + try: + name = unquote(xml.thread['name']) + except KeyError: + name = None + if not (name and name.startswith('ptvsd.')): + self.send_event('thread', reason='started', threadId=tid) @pydevd_events.handler(pydevd_comm.CMD_THREAD_KILL) def on_pydevd_thread_kill(self, seq, args): From 56756232503ca9539df129f218103937a6e9c236 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Sat, 10 Feb 2018 10:33:06 -0800 Subject: [PATCH 2/2] Addressing comments. --- ptvsd/wrapper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ptvsd/wrapper.py b/ptvsd/wrapper.py index 61318a92..3760cf32 100644 --- a/ptvsd/wrapper.py +++ b/ptvsd/wrapper.py @@ -455,6 +455,9 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel): } self.send_event('process', **evt) + def is_debugger_internal_thread(self, thread_name): + return thread_name and (thread_name.startswith('pydevd.') or thread_name.startswith('ptvsd.')) + @async_handler def on_threads(self, request, args): # TODO: docstring @@ -473,7 +476,7 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel): name = unquote(xthread['name']) except KeyError: name = None - if not (name and (name.startswith('pydevd.') or name.startswith('ptvsd.'))): + if not self.is_debugger_internal_thread(name): threads.append({'id': tid, 'name': name}) self.send_response(request, threads=threads) @@ -728,7 +731,7 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel): name = unquote(xml.thread['name']) except KeyError: name = None - if not (name and name.startswith('ptvsd.')): + if not self.is_debugger_internal_thread(name): self.send_event('thread', reason='started', threadId=tid) @pydevd_events.handler(pydevd_comm.CMD_THREAD_KILL)