Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #179 from int19h/fix-78
Browse files Browse the repository at this point in the history
Partial fix for #78
  • Loading branch information
int19h authored Mar 7, 2018
2 parents 595eb38 + b2dcefb commit 3749cfe
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ptvsd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ def __init__(self, socket, pydevd, logfile=None, killonclose=True):
self.socket = socket
self.pydevd = pydevd
self.killonclose = killonclose
self.is_process_created = False
self.is_process_created_lock = threading.Lock()
self.stack_traces = {}
self.stack_traces_lock = threading.Lock()
self.active_exceptions = {}
Expand Down Expand Up @@ -546,7 +548,6 @@ def on_configurationDone(self, request, args):
self.send_response(request)
self.process_launch_arguments()
self.pydevd_request(pydevd_comm.CMD_RUN, '')
self.send_process_event(self.start_reason)

def process_launch_arguments(self):
"""
Expand Down Expand Up @@ -803,6 +804,13 @@ def on_evaluate(self, request, args):
@async_handler
def on_pause(self, request, args):
# TODO: docstring

# Pause requests cannot be serviced until pydevd is fully initialized.
with self.is_process_created_lock:
if not self.is_process_created:
self.send_response(request, success=False, message='Cannot pause while debugger is initializing')
return

vsc_tid = int(args['threadId'])
if vsc_tid == 0: # VS does this to mean "stop all threads":
for pyd_tid in self.thread_map.pydevd_ids():
Expand Down Expand Up @@ -912,6 +920,12 @@ def on_exceptionInfo(self, request, args):

@pydevd_events.handler(pydevd_comm.CMD_THREAD_CREATE)
def on_pydevd_thread_create(self, seq, args):
# If this is the first thread reported, report process creation as well.
with self.is_process_created_lock:
if not self.is_process_created:
self.is_process_created = True
self.send_process_event(self.start_reason)

# TODO: docstring
xml = untangle.parse(args).xml
try:
Expand Down

0 comments on commit 3749cfe

Please sign in to comment.