Skip to content

Commit ff87819

Browse files
committed
feat(debugger): add some more informations in verbose mode
1 parent 054d210 commit ff87819

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

packages/debugger/src/robotcode/debugger/launcher/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ async def _launch(
197197
robotcode_run_args += ["--tcp", str(port)]
198198

199199
if debuggerTimeout is not None:
200-
robotcode_run_args += ["wait-for-client-timeout", str(debuggerTimeout)]
200+
robotcode_run_args += ["--wait-for-client-timeout", str(debuggerTimeout)]
201201

202202
if attachPython and not no_debug:
203203
robotcode_run_args += ["--debugpy"]

packages/debugger/src/robotcode/debugger/run.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import functools
3+
import os
34
import threading
45
import warnings
56
from typing import (
@@ -103,7 +104,9 @@ async def start_debugpy_async(
103104
global config_done_callback
104105

105106
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+
)
107110

108111
if wait_for_debugpy_client:
109112
wait_for_debugpy_connected()
@@ -134,11 +137,13 @@ async def run_debugger(
134137
group_output: bool = False,
135138
) -> int:
136139
if debug and debugpy and not is_debugpy_installed():
137-
print("debugpy not installed.")
140+
app.warning("Debugpy not installed.")
138141

139142
if debug and debugpy:
143+
app.verbose("Try to start debugpy session.")
140144
await start_debugpy_async(debugpy_port, addresses, debugpy_wait_for_client, wait_for_client_timeout)
141145

146+
app.verbose("Start robotcode debugger thread.")
142147
server_future = run_coroutine_in_thread(
143148
_debug_adapter_server_, config_done_callback, mode, addresses, port, pipe_name
144149
)
@@ -148,6 +153,7 @@ async def run_debugger(
148153

149154
try:
150155
if wait_for_client:
156+
app.verbose("Wait for incomming connections.")
151157
try:
152158
await run_coroutine_from_thread_async(
153159
server.protocol.wait_for_client,
@@ -162,6 +168,7 @@ async def run_debugger(
162168
await run_coroutine_from_thread_async(server.protocol.wait_for_initialized, loop=server.loop)
163169

164170
if wait_for_client:
171+
app.verbose("Wait for debug configuration.")
165172
try:
166173
await run_coroutine_from_thread_async(
167174
server.protocol.wait_for_configuration_done,
@@ -174,6 +181,7 @@ async def run_debugger(
174181
raise ConnectionError("Timeout to get configuration from client.") from e
175182

176183
if debugpy and debugpy_wait_for_client:
184+
app.verbose("Wait for debugpy incomming connections.")
177185
wait_for_debugpy_connected()
178186

179187
args = [
@@ -192,12 +200,15 @@ async def run_debugger(
192200
Debugger.instance().debug = debug
193201
Debugger.instance().set_main_thread(threading.current_thread())
194202
Debugger.instance().server_loop = server.loop
203+
204+
app.verbose("Start the debugger instance.")
195205
Debugger.instance().start()
196206

197207
exit_code = 0
198208
try:
199209
from robotcode.runner.cli.robot import robot
200210

211+
app.verbose("Start robot.")
201212
try:
202213
robot_ctx = robot.make_context("robot", args, parent=ctx)
203214
robot.invoke(robot_ctx)

vscode-client/debugmanager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ export class DebugManager {
551551
static async OnDebugpyStarted(
552552
session: vscode.DebugSession,
553553
_event: string,
554-
options?: { port: number; addresses: undefined | string[] | null },
554+
options?: { port: number; addresses: undefined | string[] | null; processId?: number | null },
555555
): Promise<boolean> {
556556
if (
557557
session.type === "robotcode" &&

0 commit comments

Comments
 (0)