1
1
import asyncio
2
2
import functools
3
+ import os
3
4
import threading
4
5
import warnings
5
6
from typing import (
@@ -103,7 +104,9 @@ async def start_debugpy_async(
103
104
global config_done_callback
104
105
105
106
def connect_debugpy (server : "DebugAdapterServer" ) -> None :
106
- server .protocol .send_event (Event (event = "debugpyStarted" , body = {"port" : port , "addresses" : addresses }))
107
+ server .protocol .send_event (
108
+ Event (event = "debugpyStarted" , body = {"port" : port , "addresses" : addresses , "processId" : os .getpid ()})
109
+ )
107
110
108
111
if wait_for_debugpy_client :
109
112
wait_for_debugpy_connected ()
@@ -134,11 +137,13 @@ async def run_debugger(
134
137
group_output : bool = False ,
135
138
) -> int :
136
139
if debug and debugpy and not is_debugpy_installed ():
137
- print ( "debugpy not installed." )
140
+ app . warning ( "Debugpy not installed." )
138
141
139
142
if debug and debugpy :
143
+ app .verbose ("Try to start debugpy session." )
140
144
await start_debugpy_async (debugpy_port , addresses , debugpy_wait_for_client , wait_for_client_timeout )
141
145
146
+ app .verbose ("Start robotcode debugger thread." )
142
147
server_future = run_coroutine_in_thread (
143
148
_debug_adapter_server_ , config_done_callback , mode , addresses , port , pipe_name
144
149
)
@@ -148,6 +153,7 @@ async def run_debugger(
148
153
149
154
try :
150
155
if wait_for_client :
156
+ app .verbose ("Wait for incomming connections." )
151
157
try :
152
158
await run_coroutine_from_thread_async (
153
159
server .protocol .wait_for_client ,
@@ -162,6 +168,7 @@ async def run_debugger(
162
168
await run_coroutine_from_thread_async (server .protocol .wait_for_initialized , loop = server .loop )
163
169
164
170
if wait_for_client :
171
+ app .verbose ("Wait for debug configuration." )
165
172
try :
166
173
await run_coroutine_from_thread_async (
167
174
server .protocol .wait_for_configuration_done ,
@@ -174,6 +181,7 @@ async def run_debugger(
174
181
raise ConnectionError ("Timeout to get configuration from client." ) from e
175
182
176
183
if debugpy and debugpy_wait_for_client :
184
+ app .verbose ("Wait for debugpy incomming connections." )
177
185
wait_for_debugpy_connected ()
178
186
179
187
args = [
@@ -192,12 +200,15 @@ async def run_debugger(
192
200
Debugger .instance ().debug = debug
193
201
Debugger .instance ().set_main_thread (threading .current_thread ())
194
202
Debugger .instance ().server_loop = server .loop
203
+
204
+ app .verbose ("Start the debugger instance." )
195
205
Debugger .instance ().start ()
196
206
197
207
exit_code = 0
198
208
try :
199
209
from robotcode .runner .cli .robot import robot
200
210
211
+ app .verbose ("Start robot." )
201
212
try :
202
213
robot_ctx = robot .make_context ("robot" , args , parent = ctx )
203
214
robot .invoke (robot_ctx )
0 commit comments