9 |
9 |
10 from PyQt6.QtCore import QObject |
10 from PyQt6.QtCore import QObject |
11 |
11 |
12 |
12 |
13 ClientDefaultCapabilities = 0 |
13 ClientDefaultCapabilities = 0 |
14 |
14 |
15 ClientTypeAssociations = [] |
15 ClientTypeAssociations = [] |
16 |
16 |
17 |
17 |
18 class DebuggerInterfaceNone(QObject): |
18 class DebuggerInterfaceNone(QObject): |
19 """ |
19 """ |
20 Class implementing a dummy debugger interface for the debug server. |
20 Class implementing a dummy debugger interface for the debug server. |
21 """ |
21 """ |
|
22 |
22 def __init__(self, debugServer, passive): |
23 def __init__(self, debugServer, passive): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 |
26 |
26 @param debugServer reference to the debug server |
27 @param debugServer reference to the debug server |
27 @type DebugServer |
28 @type DebugServer |
28 @param passive flag indicating passive connection mode |
29 @param passive flag indicating passive connection mode |
29 @type bool |
30 @type bool |
30 """ |
31 """ |
31 super().__init__() |
32 super().__init__() |
32 |
33 |
33 self.debugServer = debugServer |
34 self.debugServer = debugServer |
34 self.passive = passive |
35 self.passive = passive |
35 |
36 |
36 self.qsock = None |
37 self.qsock = None |
37 self.queue = [] |
38 self.queue = [] |
38 # set default values for capabilities of clients |
39 # set default values for capabilities of clients |
39 self.clientCapabilities = ClientDefaultCapabilities |
40 self.clientCapabilities = ClientDefaultCapabilities |
40 |
41 |
41 def startRemote(self, port, runInConsole, venvName, originalPathString, |
42 def startRemote( |
42 workingDir=None, configOverride=None): |
43 self, |
|
44 port, |
|
45 runInConsole, |
|
46 venvName, |
|
47 originalPathString, |
|
48 workingDir=None, |
|
49 configOverride=None, |
|
50 ): |
43 """ |
51 """ |
44 Public method to start a remote Python interpreter. |
52 Public method to start a remote Python interpreter. |
45 |
53 |
46 @param port port number the debug server is listening on |
54 @param port port number the debug server is listening on |
47 @type int |
55 @type int |
48 @param runInConsole flag indicating to start the debugger in a |
56 @param runInConsole flag indicating to start the debugger in a |
49 console window |
57 console window |
50 @type bool |
58 @type bool |
90 return None, True, "" |
104 return None, True, "" |
91 |
105 |
92 def getClientCapabilities(self): |
106 def getClientCapabilities(self): |
93 """ |
107 """ |
94 Public method to retrieve the debug clients capabilities. |
108 Public method to retrieve the debug clients capabilities. |
95 |
109 |
96 @return debug client capabilities |
110 @return debug client capabilities |
97 @rtype int |
111 @rtype int |
98 """ |
112 """ |
99 return self.clientCapabilities |
113 return self.clientCapabilities |
100 |
114 |
101 def newConnection(self, sock): |
115 def newConnection(self, sock): |
102 """ |
116 """ |
103 Public slot to handle a new connection. |
117 Public slot to handle a new connection. |
104 |
118 |
105 @param sock reference to the socket object |
119 @param sock reference to the socket object |
106 @type QTcpSocket |
120 @type QTcpSocket |
107 @return flag indicating success |
121 @return flag indicating success |
108 @rtype bool |
122 @rtype bool |
109 """ |
123 """ |
110 return False |
124 return False |
111 |
125 |
112 def getDebuggerIds(self): |
126 def getDebuggerIds(self): |
113 """ |
127 """ |
114 Public method to return the IDs of the connected debugger backends. |
128 Public method to return the IDs of the connected debugger backends. |
115 |
129 |
116 @return list of connected debugger backend IDs |
130 @return list of connected debugger backend IDs |
117 @rtype list of str |
131 @rtype list of str |
118 """ |
132 """ |
119 return [] |
133 return [] |
120 |
134 |
121 def shutdown(self): |
135 def shutdown(self): |
122 """ |
136 """ |
123 Public method to cleanly shut down. |
137 Public method to cleanly shut down. |
124 |
138 |
125 It closes our socket and shuts down the debug client. |
139 It closes our socket and shuts down the debug client. |
126 (Needed on Win OS) |
140 (Needed on Win OS) |
127 """ |
141 """ |
128 self.qsock = None |
142 self.qsock = None |
129 self.queue = [] |
143 self.queue = [] |
130 |
144 |
131 def isConnected(self): |
145 def isConnected(self): |
132 """ |
146 """ |
133 Public method to test, if a debug client has connected. |
147 Public method to test, if a debug client has connected. |
134 |
148 |
135 @return flag indicating the connection status |
149 @return flag indicating the connection status |
136 @rtype bool |
150 @rtype bool |
137 """ |
151 """ |
138 return self.qsock is not None |
152 return self.qsock is not None |
139 |
153 |
140 def remoteEnvironment(self, env): |
154 def remoteEnvironment(self, env): |
141 """ |
155 """ |
142 Public method to set the environment for a program to debug, run, ... |
156 Public method to set the environment for a program to debug, run, ... |
143 |
157 |
144 @param env environment settings |
158 @param env environment settings |
145 @type dict |
159 @type dict |
146 """ |
160 """ |
147 return |
161 return |
148 |
162 |
149 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, |
163 def remoteLoad( |
150 autoContinue=True, enableMultiprocess=False): |
164 self, |
|
165 fn, |
|
166 argv, |
|
167 wd, |
|
168 traceInterpreter=False, |
|
169 autoContinue=True, |
|
170 enableMultiprocess=False, |
|
171 ): |
151 """ |
172 """ |
152 Public method to load a new program to debug. |
173 Public method to load a new program to debug. |
153 |
174 |
154 @param fn the filename to debug |
175 @param fn the filename to debug |
155 @type str |
176 @type str |
156 @param argv the commandline arguments to pass to the program |
177 @param argv the commandline arguments to pass to the program |
157 @type str |
178 @type str |
158 @param wd the working directory for the program |
179 @param wd the working directory for the program |
166 @param enableMultiprocess flag indicating to perform multiprocess |
187 @param enableMultiprocess flag indicating to perform multiprocess |
167 debugging |
188 debugging |
168 @type bool |
189 @type bool |
169 """ |
190 """ |
170 return |
191 return |
171 |
192 |
172 def remoteRun(self, fn, argv, wd): |
193 def remoteRun(self, fn, argv, wd): |
173 """ |
194 """ |
174 Public method to load a new program to run. |
195 Public method to load a new program to run. |
175 |
196 |
176 @param fn the filename to run |
197 @param fn the filename to run |
177 @type str |
198 @type str |
178 @param argv the commandline arguments to pass to the program |
199 @param argv the commandline arguments to pass to the program |
179 @type str |
200 @type str |
180 @param wd the working directory for the program |
201 @param wd the working directory for the program |
181 @type str |
202 @type str |
182 """ |
203 """ |
183 return |
204 return |
184 |
205 |
185 def remoteCoverage(self, fn, argv, wd, erase=False): |
206 def remoteCoverage(self, fn, argv, wd, erase=False): |
186 """ |
207 """ |
187 Public method to load a new program to collect coverage data. |
208 Public method to load a new program to collect coverage data. |
188 |
209 |
189 @param fn the filename to run |
210 @param fn the filename to run |
190 @type str |
211 @type str |
191 @param argv the commandline arguments to pass to the program |
212 @param argv the commandline arguments to pass to the program |
192 @type str |
213 @type str |
193 @param wd the working directory for the program |
214 @param wd the working directory for the program |
227 return |
248 return |
228 |
249 |
229 def remoteStep(self, debuggerId): |
250 def remoteStep(self, debuggerId): |
230 """ |
251 """ |
231 Public method to single step the debugged program. |
252 Public method to single step the debugged program. |
232 |
253 |
233 @param debuggerId ID of the debugger backend |
254 @param debuggerId ID of the debugger backend |
234 @type str |
255 @type str |
235 """ |
256 """ |
236 return |
257 return |
237 |
258 |
238 def remoteStepOver(self, debuggerId): |
259 def remoteStepOver(self, debuggerId): |
239 """ |
260 """ |
240 Public method to step over the debugged program. |
261 Public method to step over the debugged program. |
241 |
262 |
242 @param debuggerId ID of the debugger backend |
263 @param debuggerId ID of the debugger backend |
243 @type str |
264 @type str |
244 """ |
265 """ |
245 return |
266 return |
246 |
267 |
247 def remoteStepOut(self, debuggerId): |
268 def remoteStepOut(self, debuggerId): |
248 """ |
269 """ |
249 Public method to step out the debugged program. |
270 Public method to step out the debugged program. |
250 |
271 |
251 @param debuggerId ID of the debugger backend |
272 @param debuggerId ID of the debugger backend |
252 @type str |
273 @type str |
253 """ |
274 """ |
254 return |
275 return |
255 |
276 |
256 def remoteStepQuit(self, debuggerId): |
277 def remoteStepQuit(self, debuggerId): |
257 """ |
278 """ |
258 Public method to stop the debugged program. |
279 Public method to stop the debugged program. |
259 |
280 |
260 @param debuggerId ID of the debugger backend |
281 @param debuggerId ID of the debugger backend |
261 @type str |
282 @type str |
262 """ |
283 """ |
263 return |
284 return |
264 |
285 |
265 def remoteContinue(self, debuggerId, special=False): |
286 def remoteContinue(self, debuggerId, special=False): |
266 """ |
287 """ |
267 Public method to continue the debugged program. |
288 Public method to continue the debugged program. |
268 |
289 |
269 @param debuggerId ID of the debugger backend |
290 @param debuggerId ID of the debugger backend |
270 @type str |
291 @type str |
271 @param special flag indicating a special continue operation |
292 @param special flag indicating a special continue operation |
272 @type bool |
293 @type bool |
273 """ |
294 """ |
275 |
296 |
276 def remoteContinueUntil(self, debuggerId, line): |
297 def remoteContinueUntil(self, debuggerId, line): |
277 """ |
298 """ |
278 Public method to continue the debugged program to the given line |
299 Public method to continue the debugged program to the given line |
279 or until returning from the current frame. |
300 or until returning from the current frame. |
280 |
301 |
281 @param debuggerId ID of the debugger backend |
302 @param debuggerId ID of the debugger backend |
282 @type str |
303 @type str |
283 @param line the new line, where execution should be continued to |
304 @param line the new line, where execution should be continued to |
284 @type int |
305 @type int |
285 """ |
306 """ |
286 return |
307 return |
287 |
308 |
288 def remoteMoveIP(self, debuggerId, line): |
309 def remoteMoveIP(self, debuggerId, line): |
289 """ |
310 """ |
290 Public method to move the instruction pointer to a different line. |
311 Public method to move the instruction pointer to a different line. |
291 |
312 |
292 @param debuggerId ID of the debugger backend |
313 @param debuggerId ID of the debugger backend |
293 @type str |
314 @type str |
294 @param line the new line, where execution should be continued |
315 @param line the new line, where execution should be continued |
295 @type int |
316 @type int |
296 """ |
317 """ |
297 return |
318 return |
298 |
319 |
299 def remoteBreakpoint(self, debuggerId, fn, line, setBreakpoint, cond=None, |
320 def remoteBreakpoint( |
300 temp=False): |
321 self, debuggerId, fn, line, setBreakpoint, cond=None, temp=False |
|
322 ): |
301 """ |
323 """ |
302 Public method to set or clear a breakpoint. |
324 Public method to set or clear a breakpoint. |
303 |
325 |
304 @param debuggerId ID of the debugger backend |
326 @param debuggerId ID of the debugger backend |
305 @type str |
327 @type str |
306 @param fn filename the breakpoint belongs to |
328 @param fn filename the breakpoint belongs to |
307 @type str |
329 @type str |
308 @param line linenumber of the breakpoint |
330 @param line linenumber of the breakpoint |
313 @type str |
335 @type str |
314 @param temp flag indicating a temporary breakpoint |
336 @param temp flag indicating a temporary breakpoint |
315 @type bool |
337 @type bool |
316 """ |
338 """ |
317 return |
339 return |
318 |
340 |
319 def remoteBreakpointEnable(self, debuggerId, fn, line, enable): |
341 def remoteBreakpointEnable(self, debuggerId, fn, line, enable): |
320 """ |
342 """ |
321 Public method to enable or disable a breakpoint. |
343 Public method to enable or disable a breakpoint. |
322 |
344 |
323 @param debuggerId ID of the debugger backend |
345 @param debuggerId ID of the debugger backend |
324 @type str |
346 @type str |
325 @param fn filename the breakpoint belongs to |
347 @param fn filename the breakpoint belongs to |
326 @type str |
348 @type str |
327 @param line linenumber of the breakpoint |
349 @param line linenumber of the breakpoint |
328 @type int |
350 @type int |
329 @param enable flag indicating enabling or disabling a breakpoint |
351 @param enable flag indicating enabling or disabling a breakpoint |
330 @type bool |
352 @type bool |
331 """ |
353 """ |
332 return |
354 return |
333 |
355 |
334 def remoteBreakpointIgnore(self, debuggerId, fn, line, count): |
356 def remoteBreakpointIgnore(self, debuggerId, fn, line, count): |
335 """ |
357 """ |
336 Public method to ignore a breakpoint the next couple of occurrences. |
358 Public method to ignore a breakpoint the next couple of occurrences. |
337 |
359 |
338 @param debuggerId ID of the debugger backend |
360 @param debuggerId ID of the debugger backend |
339 @type str |
361 @type str |
340 @param fn filename the breakpoint belongs to |
362 @param fn filename the breakpoint belongs to |
341 @type str |
363 @type str |
342 @param line linenumber of the breakpoint |
364 @param line linenumber of the breakpoint |
343 @type int |
365 @type int |
344 @param count number of occurrences to ignore |
366 @param count number of occurrences to ignore |
345 @type int |
367 @type int |
346 """ |
368 """ |
347 return |
369 return |
348 |
370 |
349 def remoteWatchpoint(self, debuggerId, cond, setWatch, temp=False): |
371 def remoteWatchpoint(self, debuggerId, cond, setWatch, temp=False): |
350 """ |
372 """ |
351 Public method to set or clear a watch expression. |
373 Public method to set or clear a watch expression. |
352 |
374 |
353 @param debuggerId ID of the debugger backend |
375 @param debuggerId ID of the debugger backend |
354 @type str |
376 @type str |
355 @param cond expression of the watch expression |
377 @param cond expression of the watch expression |
356 @type str |
378 @type str |
357 @param setWatch flag indicating setting or resetting a watch expression |
379 @param setWatch flag indicating setting or resetting a watch expression |
358 @type bool |
380 @type bool |
359 @param temp flag indicating a temporary watch expression |
381 @param temp flag indicating a temporary watch expression |
360 @type bool |
382 @type bool |
361 """ |
383 """ |
362 return |
384 return |
363 |
385 |
364 def remoteWatchpointEnable(self, debuggerId, cond, enable): |
386 def remoteWatchpointEnable(self, debuggerId, cond, enable): |
365 """ |
387 """ |
366 Public method to enable or disable a watch expression. |
388 Public method to enable or disable a watch expression. |
367 |
389 |
368 @param debuggerId ID of the debugger backend |
390 @param debuggerId ID of the debugger backend |
369 @type str |
391 @type str |
370 @param cond expression of the watch expression |
392 @param cond expression of the watch expression |
371 @type str |
393 @type str |
372 @param enable flag indicating enabling or disabling a watch expression |
394 @param enable flag indicating enabling or disabling a watch expression |
373 @type bool |
395 @type bool |
374 """ |
396 """ |
375 return |
397 return |
376 |
398 |
377 def remoteWatchpointIgnore(self, debuggerId, cond, count): |
399 def remoteWatchpointIgnore(self, debuggerId, cond, count): |
378 """ |
400 """ |
379 Public method to ignore a watch expression the next couple of |
401 Public method to ignore a watch expression the next couple of |
380 occurrences. |
402 occurrences. |
381 |
403 |
382 @param debuggerId ID of the debugger backend |
404 @param debuggerId ID of the debugger backend |
383 @type str |
405 @type str |
384 @param cond expression of the watch expression |
406 @param cond expression of the watch expression |
385 @type str |
407 @type str |
386 @param count number of occurrences to ignore |
408 @param count number of occurrences to ignore |
387 @type int |
409 @type int |
388 """ |
410 """ |
389 return |
411 return |
390 |
412 |
391 def remoteRawInput(self, debuggerId, inputString): |
413 def remoteRawInput(self, debuggerId, inputString): |
392 """ |
414 """ |
393 Public method to send the raw input to the debugged program. |
415 Public method to send the raw input to the debugged program. |
394 |
416 |
395 @param debuggerId ID of the debugger backend |
417 @param debuggerId ID of the debugger backend |
396 @type str |
418 @type str |
397 @param inputString the raw input |
419 @param inputString the raw input |
398 @type str |
420 @type str |
399 """ |
421 """ |
400 return |
422 return |
401 |
423 |
402 def remoteThreadList(self, debuggerId): |
424 def remoteThreadList(self, debuggerId): |
403 """ |
425 """ |
404 Public method to request the list of threads from the client. |
426 Public method to request the list of threads from the client. |
405 |
427 |
406 @param debuggerId ID of the debugger backend |
428 @param debuggerId ID of the debugger backend |
407 @type str |
429 @type str |
408 """ |
430 """ |
409 return |
431 return |
410 |
432 |
411 def remoteSetThread(self, debuggerId, tid): |
433 def remoteSetThread(self, debuggerId, tid): |
412 """ |
434 """ |
413 Public method to request to set the given thread as current thread. |
435 Public method to request to set the given thread as current thread. |
414 |
436 |
415 @param debuggerId ID of the debugger backend |
437 @param debuggerId ID of the debugger backend |
416 @type str |
438 @type str |
417 @param tid id of the thread |
439 @param tid id of the thread |
418 @type int |
440 @type int |
419 """ |
441 """ |
420 return |
442 return |
421 |
443 |
422 def remoteClientStack(self, debuggerId): |
444 def remoteClientStack(self, debuggerId): |
423 """ |
445 """ |
424 Public method to request the stack of the main thread. |
446 Public method to request the stack of the main thread. |
425 |
447 |
426 @param debuggerId ID of the debugger backend |
448 @param debuggerId ID of the debugger backend |
427 @type str |
449 @type str |
428 """ |
450 """ |
429 return |
451 return |
430 |
452 |
431 def remoteClientVariables(self, debuggerId, scope, filterList, framenr=0, |
453 def remoteClientVariables( |
432 maxSize=0): |
454 self, debuggerId, scope, filterList, framenr=0, maxSize=0 |
|
455 ): |
433 """ |
456 """ |
434 Public method to request the variables of the debugged program. |
457 Public method to request the variables of the debugged program. |
435 |
458 |
436 @param debuggerId ID of the debugger backend |
459 @param debuggerId ID of the debugger backend |
437 @type str |
460 @type str |
438 @param scope the scope of the variables (0 = local, 1 = global) |
461 @param scope the scope of the variables (0 = local, 1 = global) |
439 @type int |
462 @type int |
440 @param filterList list of variable types to filter out |
463 @param filterList list of variable types to filter out |
467 be shown. If it is bigger than that, a 'too big' indication will |
491 be shown. If it is bigger than that, a 'too big' indication will |
468 be given (@@TOO_BIG_TO_SHOW@@). |
492 be given (@@TOO_BIG_TO_SHOW@@). |
469 @type int |
493 @type int |
470 """ |
494 """ |
471 return |
495 return |
472 |
496 |
473 def remoteClientDisassembly(self, debuggerId): |
497 def remoteClientDisassembly(self, debuggerId): |
474 """ |
498 """ |
475 Public method to ask the client for the latest traceback disassembly. |
499 Public method to ask the client for the latest traceback disassembly. |
476 |
500 |
477 @param debuggerId ID of the debugger backend |
501 @param debuggerId ID of the debugger backend |
478 @type str |
502 @type str |
479 """ |
503 """ |
480 return |
504 return |
481 |
505 |
482 def remoteClientSetFilter(self, debuggerId, scope, filterStr): |
506 def remoteClientSetFilter(self, debuggerId, scope, filterStr): |
483 """ |
507 """ |
484 Public method to set a variables filter list. |
508 Public method to set a variables filter list. |
485 |
509 |
486 @param debuggerId ID of the debugger backend |
510 @param debuggerId ID of the debugger backend |
487 @type str |
511 @type str |
488 @param scope the scope of the variables (0 = local, 1 = global) |
512 @param scope the scope of the variables (0 = local, 1 = global) |
489 @type int |
513 @type int |
490 @param filterStr regexp string for variable names to filter out |
514 @param filterStr regexp string for variable names to filter out |
491 @type str |
515 @type str |
492 """ |
516 """ |
493 return |
517 return |
494 |
518 |
495 def setCallTraceEnabled(self, debuggerId, on): |
519 def setCallTraceEnabled(self, debuggerId, on): |
496 """ |
520 """ |
497 Public method to set the call trace state. |
521 Public method to set the call trace state. |
498 |
522 |
499 @param debuggerId ID of the debugger backend |
523 @param debuggerId ID of the debugger backend |
500 @type str |
524 @type str |
501 @param on flag indicating to enable the call trace function |
525 @param on flag indicating to enable the call trace function |
502 @type bool |
526 @type bool |
503 """ |
527 """ |
504 return |
528 return |
505 |
529 |
506 def remoteNoDebugList(self, debuggerId, noDebugList): |
530 def remoteNoDebugList(self, debuggerId, noDebugList): |
507 """ |
531 """ |
508 Public method to set a list of programs not to be debugged. |
532 Public method to set a list of programs not to be debugged. |
509 |
533 |
510 The programs given in the list will not be run under the control |
534 The programs given in the list will not be run under the control |
511 of the multi process debugger. |
535 of the multi process debugger. |
512 |
536 |
513 @param debuggerId ID of the debugger backend |
537 @param debuggerId ID of the debugger backend |
514 @type str |
538 @type str |
515 @param noDebugList list of Python programs not to be debugged |
539 @param noDebugList list of Python programs not to be debugged |
516 @type list of str |
540 @type list of str |
517 """ |
541 """ |
518 return |
542 return |
519 |
543 |
520 def remoteBanner(self): |
544 def remoteBanner(self): |
521 """ |
545 """ |
522 Public slot to get the banner info of the remote client. |
546 Public slot to get the banner info of the remote client. |
523 """ |
547 """ |
524 return |
548 return |
525 |
549 |
526 def remoteCapabilities(self, debuggerId): |
550 def remoteCapabilities(self, debuggerId): |
527 """ |
551 """ |
528 Public slot to get the debug clients capabilities. |
552 Public slot to get the debug clients capabilities. |
529 |
553 |
530 @param debuggerId ID of the debugger backend |
554 @param debuggerId ID of the debugger backend |
531 @type str |
555 @type str |
532 """ |
556 """ |
533 return |
557 return |
534 |
558 |
535 def remoteCompletion(self, debuggerId, text): |
559 def remoteCompletion(self, debuggerId, text): |
536 """ |
560 """ |
537 Public slot to get the a list of possible commandline completions |
561 Public slot to get the a list of possible commandline completions |
538 from the remote client. |
562 from the remote client. |
539 |
563 |
540 @param debuggerId ID of the debugger backend |
564 @param debuggerId ID of the debugger backend |
541 @type str |
565 @type str |
542 @param text the text to be completed |
566 @param text the text to be completed |
543 @type str |
567 @type str |
544 """ |
568 """ |