@@ -133,6 +133,7 @@ def __init__(
133133 self .output_condition = threading .Condition ()
134134 self .output : dict [str , list [str ]] = {}
135135 self .configuration_done_sent = False
136+ self .initialized = False
136137 self .frame_scopes = {}
137138 self .init_commands = init_commands
138139 self .disassembled_instructions = {}
@@ -235,6 +236,8 @@ def _handle_recv_packet(self, packet: Optional[ProtocolMessage]) -> bool:
235236 self .output_condition .release ()
236237 # no need to add 'output' event packets to our packets list
237238 return keepGoing
239+ elif event == "initialized" :
240+ self .initialized = True
238241 elif event == "process" :
239242 # When a new process is attached or launched, remember the
240243 # details that are available in the body of the event
@@ -602,7 +605,7 @@ def request_attach(
602605 exitCommands : Optional [list [str ]] = None ,
603606 terminateCommands : Optional [list [str ]] = None ,
604607 coreFile : Optional [str ] = None ,
605- stopOnAttach = True ,
608+ stopOnEntry = False ,
606609 sourceMap : Optional [Union [list [tuple [str , str ]], dict [str , str ]]] = None ,
607610 gdbRemotePort : Optional [int ] = None ,
608611 gdbRemoteHostname : Optional [str ] = None ,
@@ -629,8 +632,8 @@ def request_attach(
629632 args_dict ["attachCommands" ] = attachCommands
630633 if coreFile :
631634 args_dict ["coreFile" ] = coreFile
632- if stopOnAttach :
633- args_dict ["stopOnEntry" ] = stopOnAttach
635+ if stopOnEntry :
636+ args_dict ["stopOnEntry" ] = stopOnEntry
634637 if postRunCommands :
635638 args_dict ["postRunCommands" ] = postRunCommands
636639 if sourceMap :
@@ -640,11 +643,7 @@ def request_attach(
640643 if gdbRemoteHostname is not None :
641644 args_dict ["gdb-remote-hostname" ] = gdbRemoteHostname
642645 command_dict = {"command" : "attach" , "type" : "request" , "arguments" : args_dict }
643- response = self .send_recv (command_dict )
644-
645- if response ["success" ]:
646- self .wait_for_event ("process" )
647- return response
646+ return self .send_recv (command_dict )
648647
649648 def request_breakpointLocations (
650649 self , file_path , line , end_line = None , column = None , end_column = None
@@ -677,6 +676,7 @@ def request_configurationDone(self):
677676 response = self .send_recv (command_dict )
678677 if response :
679678 self .configuration_done_sent = True
679+ self .request_threads ()
680680 return response
681681
682682 def _process_stopped (self ):
@@ -824,7 +824,7 @@ def request_launch(
824824 args : Optional [list [str ]] = None ,
825825 cwd : Optional [str ] = None ,
826826 env : Optional [dict [str , str ]] = None ,
827- stopOnEntry = True ,
827+ stopOnEntry = False ,
828828 disableASLR = True ,
829829 disableSTDIO = False ,
830830 shellExpandArguments = False ,
@@ -894,11 +894,7 @@ def request_launch(
894894 if commandEscapePrefix is not None :
895895 args_dict ["commandEscapePrefix" ] = commandEscapePrefix
896896 command_dict = {"command" : "launch" , "type" : "request" , "arguments" : args_dict }
897- response = self .send_recv (command_dict )
898-
899- if response ["success" ]:
900- self .wait_for_event ("process" )
901- return response
897+ return self .send_recv (command_dict )
902898
903899 def request_next (self , threadId , granularity = "statement" ):
904900 if self .exit_status is not None :
0 commit comments