eric7/Debugger/DebuggerInterfaceNone.py

branch
eric7
changeset 8312
800c432b34c8
parent 8218
7c09585bd960
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2007 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dummy debugger interface for the debug server.
8 """
9
10 from PyQt5.QtCore import QObject
11
12
13 ClientDefaultCapabilities = 0
14
15 ClientTypeAssociations = []
16
17
18 class DebuggerInterfaceNone(QObject):
19 """
20 Class implementing a dummy debugger interface for the debug server.
21 """
22 def __init__(self, debugServer, passive):
23 """
24 Constructor
25
26 @param debugServer reference to the debug server
27 @type DebugServer
28 @param passive flag indicating passive connection mode
29 @type bool
30 """
31 super().__init__()
32
33 self.debugServer = debugServer
34 self.passive = passive
35
36 self.qsock = None
37 self.queue = []
38 # set default values for capabilities of clients
39 self.clientCapabilities = ClientDefaultCapabilities
40
41 def startRemote(self, port, runInConsole, venvName, originalPathString,
42 workingDir=None):
43 """
44 Public method to start a remote Python interpreter.
45
46 @param port port number the debug server is listening on
47 @type int
48 @param runInConsole flag indicating to start the debugger in a
49 console window
50 @type bool
51 @param venvName name of the virtual environment to be used
52 @type str
53 @param originalPathString original PATH environment variable
54 @type str
55 @param workingDir directory to start the debugger client in
56 @type str
57 @return client process object, a flag to indicate a network connection
58 and the name of the interpreter in case of a local execution
59 @rtype tuple of (QProcess, bool, str)
60 """
61 return None, True, ""
62
63 def startRemoteForProject(self, port, runInConsole, venvName,
64 originalPathString, workingDir=None):
65 """
66 Public method to start a remote Python interpreter for a project.
67
68 @param port port number the debug server is listening on
69 @type int
70 @param runInConsole flag indicating to start the debugger in a
71 console window
72 @type bool
73 @param venvName name of the virtual environment to be used
74 @type str
75 @param originalPathString original PATH environment variable
76 @type str
77 @param workingDir directory to start the debugger client in
78 @type str
79 @return client process object, a flag to indicate a network connection
80 and the name of the interpreter in case of a local execution
81 @rtype tuple of (QProcess, bool, str)
82 """
83 return None, True, ""
84
85 def getClientCapabilities(self):
86 """
87 Public method to retrieve the debug clients capabilities.
88
89 @return debug client capabilities
90 @rtype int
91 """
92 return self.clientCapabilities
93
94 def newConnection(self, sock):
95 """
96 Public slot to handle a new connection.
97
98 @param sock reference to the socket object
99 @type QTcpSocket
100 @return flag indicating success
101 @rtype bool
102 """
103 return False
104
105 def getDebuggerIds(self):
106 """
107 Public method to return the IDs of the connected debugger backends.
108
109 @return list of connected debugger backend IDs
110 @rtype list of str
111 """
112 return []
113
114 def shutdown(self):
115 """
116 Public method to cleanly shut down.
117
118 It closes our socket and shuts down the debug client.
119 (Needed on Win OS)
120 """
121 self.qsock = None
122 self.queue = []
123
124 def isConnected(self):
125 """
126 Public method to test, if a debug client has connected.
127
128 @return flag indicating the connection status
129 @rtype bool
130 """
131 return self.qsock is not None
132
133 def remoteEnvironment(self, env):
134 """
135 Public method to set the environment for a program to debug, run, ...
136
137 @param env environment settings
138 @type dict
139 """
140 return
141
142 def remoteLoad(self, fn, argv, wd, traceInterpreter=False,
143 autoContinue=True, enableMultiprocess=False):
144 """
145 Public method to load a new program to debug.
146
147 @param fn the filename to debug
148 @type str
149 @param argv the commandline arguments to pass to the program
150 @type str
151 @param wd the working directory for the program
152 @type str
153 @param traceInterpreter flag indicating if the interpreter library
154 should be traced as well
155 @type bool
156 @param autoContinue flag indicating, that the debugger should not
157 stop at the first executable line
158 @type bool
159 @param enableMultiprocess flag indicating to perform multiprocess
160 debugging
161 @type bool
162 """
163 return
164
165 def remoteRun(self, fn, argv, wd):
166 """
167 Public method to load a new program to run.
168
169 @param fn the filename to run
170 @type str
171 @param argv the commandline arguments to pass to the program
172 @type str
173 @param wd the working directory for the program
174 @type str
175 """
176 return
177
178 def remoteCoverage(self, fn, argv, wd, erase=False):
179 """
180 Public method to load a new program to collect coverage data.
181
182 @param fn the filename to run
183 @type str
184 @param argv the commandline arguments to pass to the program
185 @type str
186 @param wd the working directory for the program
187 @type str
188 @param erase flag indicating that coverage info should be
189 cleared first
190 @type bool
191 """
192 return
193
194 def remoteProfile(self, fn, argv, wd, erase=False):
195 """
196 Public method to load a new program to collect profiling data.
197
198 @param fn the filename to run
199 @type str
200 @param argv the commandline arguments to pass to the program
201 @type str
202 @param wd the working directory for the program
203 @type str
204 @param erase flag indicating that timing info should be cleared
205 first
206 @type bool
207 """
208 return
209
210 def remoteStatement(self, debuggerId, stmt):
211 """
212 Public method to execute a Python statement.
213
214 @param debuggerId ID of the debugger backend
215 @type str
216 @param stmt the Python statement to execute.
217 @type str
218 """
219 self.debugServer.signalClientStatement(False, "")
220 return
221
222 def remoteStep(self, debuggerId):
223 """
224 Public method to single step the debugged program.
225
226 @param debuggerId ID of the debugger backend
227 @type str
228 """
229 return
230
231 def remoteStepOver(self, debuggerId):
232 """
233 Public method to step over the debugged program.
234
235 @param debuggerId ID of the debugger backend
236 @type str
237 """
238 return
239
240 def remoteStepOut(self, debuggerId):
241 """
242 Public method to step out the debugged program.
243
244 @param debuggerId ID of the debugger backend
245 @type str
246 """
247 return
248
249 def remoteStepQuit(self, debuggerId):
250 """
251 Public method to stop the debugged program.
252
253 @param debuggerId ID of the debugger backend
254 @type str
255 """
256 return
257
258 def remoteContinue(self, debuggerId, special=False):
259 """
260 Public method to continue the debugged program.
261
262 @param debuggerId ID of the debugger backend
263 @type str
264 @param special flag indicating a special continue operation
265 @type bool
266 """
267 return
268
269 def remoteContinueUntil(self, debuggerId, line):
270 """
271 Public method to continue the debugged program to the given line
272 or until returning from the current frame.
273
274 @param debuggerId ID of the debugger backend
275 @type str
276 @param line the new line, where execution should be continued to
277 @type int
278 """
279 return
280
281 def remoteMoveIP(self, debuggerId, line):
282 """
283 Public method to move the instruction pointer to a different line.
284
285 @param debuggerId ID of the debugger backend
286 @type str
287 @param line the new line, where execution should be continued
288 @type int
289 """
290 return
291
292 def remoteBreakpoint(self, debuggerId, fn, line, setBreakpoint, cond=None,
293 temp=False):
294 """
295 Public method to set or clear a breakpoint.
296
297 @param debuggerId ID of the debugger backend
298 @type str
299 @param fn filename the breakpoint belongs to
300 @type str
301 @param line linenumber of the breakpoint
302 @type int
303 @param setBreakpoint flag indicating setting or resetting a breakpoint
304 @type bool
305 @param cond condition of the breakpoint
306 @type str
307 @param temp flag indicating a temporary breakpoint
308 @type bool
309 """
310 return
311
312 def remoteBreakpointEnable(self, debuggerId, fn, line, enable):
313 """
314 Public method to enable or disable a breakpoint.
315
316 @param debuggerId ID of the debugger backend
317 @type str
318 @param fn filename the breakpoint belongs to
319 @type str
320 @param line linenumber of the breakpoint
321 @type int
322 @param enable flag indicating enabling or disabling a breakpoint
323 @type bool
324 """
325 return
326
327 def remoteBreakpointIgnore(self, debuggerId, fn, line, count):
328 """
329 Public method to ignore a breakpoint the next couple of occurrences.
330
331 @param debuggerId ID of the debugger backend
332 @type str
333 @param fn filename the breakpoint belongs to
334 @type str
335 @param line linenumber of the breakpoint
336 @type int
337 @param count number of occurrences to ignore
338 @type int
339 """
340 return
341
342 def remoteWatchpoint(self, debuggerId, cond, setWatch, temp=False):
343 """
344 Public method to set or clear a watch expression.
345
346 @param debuggerId ID of the debugger backend
347 @type str
348 @param cond expression of the watch expression
349 @type str
350 @param setWatch flag indicating setting or resetting a watch expression
351 @type bool
352 @param temp flag indicating a temporary watch expression
353 @type bool
354 """
355 return
356
357 def remoteWatchpointEnable(self, debuggerId, cond, enable):
358 """
359 Public method to enable or disable a watch expression.
360
361 @param debuggerId ID of the debugger backend
362 @type str
363 @param cond expression of the watch expression
364 @type str
365 @param enable flag indicating enabling or disabling a watch expression
366 @type bool
367 """
368 return
369
370 def remoteWatchpointIgnore(self, debuggerId, cond, count):
371 """
372 Public method to ignore a watch expression the next couple of
373 occurrences.
374
375 @param debuggerId ID of the debugger backend
376 @type str
377 @param cond expression of the watch expression
378 @type str
379 @param count number of occurrences to ignore
380 @type int
381 """
382 return
383
384 def remoteRawInput(self, debuggerId, inputString):
385 """
386 Public method to send the raw input to the debugged program.
387
388 @param debuggerId ID of the debugger backend
389 @type str
390 @param inputString the raw input
391 @type str
392 """
393 return
394
395 def remoteThreadList(self, debuggerId):
396 """
397 Public method to request the list of threads from the client.
398
399 @param debuggerId ID of the debugger backend
400 @type str
401 """
402 return
403
404 def remoteSetThread(self, debuggerId, tid):
405 """
406 Public method to request to set the given thread as current thread.
407
408 @param debuggerId ID of the debugger backend
409 @type str
410 @param tid id of the thread
411 @type int
412 """
413 return
414
415 def remoteClientStack(self, debuggerId):
416 """
417 Public method to request the stack of the main thread.
418
419 @param debuggerId ID of the debugger backend
420 @type str
421 """
422 return
423
424 def remoteClientVariables(self, debuggerId, scope, filterList, framenr=0,
425 maxSize=0):
426 """
427 Public method to request the variables of the debugged program.
428
429 @param debuggerId ID of the debugger backend
430 @type str
431 @param scope the scope of the variables (0 = local, 1 = global)
432 @type int
433 @param filterList list of variable types to filter out
434 @type list of str
435 @param framenr framenumber of the variables to retrieve
436 @type int
437 @param maxSize maximum size the formatted value of a variable will
438 be shown. If it is bigger than that, a 'too big' indication will
439 be given (@@TOO_BIG_TO_SHOW@@).
440 @type int
441 """
442 return
443
444 def remoteClientVariable(self, debuggerId, scope, filterList, var,
445 framenr=0, maxSize=0):
446 """
447 Public method to request the variables of the debugged program.
448
449 @param debuggerId ID of the debugger backend
450 @type str
451 @param scope the scope of the variables (0 = local, 1 = global)
452 @type int
453 @param filterList list of variable types to filter out
454 @type list of str
455 @param var list encoded name of variable to retrieve
456 @type list of str
457 @param framenr framenumber of the variables to retrieve
458 @type int
459 @param maxSize maximum size the formatted value of a variable will
460 be shown. If it is bigger than that, a 'too big' indication will
461 be given (@@TOO_BIG_TO_SHOW@@).
462 @type int
463 """
464 return
465
466 def remoteClientDisassembly(self, debuggerId):
467 """
468 Public method to ask the client for the latest traceback disassembly.
469
470 @param debuggerId ID of the debugger backend
471 @type str
472 """
473 return
474
475 def remoteClientSetFilter(self, debuggerId, scope, filterStr):
476 """
477 Public method to set a variables filter list.
478
479 @param debuggerId ID of the debugger backend
480 @type str
481 @param scope the scope of the variables (0 = local, 1 = global)
482 @type int
483 @param filterStr regexp string for variable names to filter out
484 @type str
485 """
486 return
487
488 def setCallTraceEnabled(self, debuggerId, on):
489 """
490 Public method to set the call trace state.
491
492 @param debuggerId ID of the debugger backend
493 @type str
494 @param on flag indicating to enable the call trace function
495 @type bool
496 """
497 return
498
499 def remoteNoDebugList(self, debuggerId, noDebugList):
500 """
501 Public method to set a list of programs not to be debugged.
502
503 The programs given in the list will not be run under the control
504 of the multi process debugger.
505
506 @param debuggerId ID of the debugger backend
507 @type str
508 @param noDebugList list of Python programs not to be debugged
509 @type list of str
510 """
511 return
512
513 def remoteBanner(self):
514 """
515 Public slot to get the banner info of the remote client.
516 """
517 return
518
519 def remoteCapabilities(self, debuggerId):
520 """
521 Public slot to get the debug clients capabilities.
522
523 @param debuggerId ID of the debugger backend
524 @type str
525 """
526 return
527
528 def remoteCompletion(self, debuggerId, text):
529 """
530 Public slot to get the a list of possible commandline completions
531 from the remote client.
532
533 @param debuggerId ID of the debugger backend
534 @type str
535 @param text the text to be completed
536 @type str
537 """
538 return
539
540 def remoteUTDiscover(self, syspath, workdir, discoveryStart):
541 """
542 Public method to perform a test case discovery.
543
544 @param syspath list of directories to be added to sys.path on the
545 remote side
546 @type list of str
547 @param workdir path name of the working directory
548 @type str
549 @param discoveryStart directory to start auto-discovery at
550 @type str
551 """
552 return
553
554 def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase,
555 syspath, workdir, discover, discoveryStart, testCases,
556 debug):
557 """
558 Public method to prepare a new unittest run.
559
560 @param fn name of file to load
561 @type str
562 @param tn name of test to load
563 @type str
564 @param tfn test function name to load tests from
565 @type str
566 @param failed list of failed test, if only failed test should be run
567 @type list of str
568 @param cov flag indicating collection of coverage data is requested
569 @type bool
570 @param covname name of file to be used to assemble the coverage caches
571 filename
572 @type str
573 @param coverase flag indicating erasure of coverage data is requested
574 @type bool
575 @param syspath list of directories to be added to sys.path on the
576 remote side
577 @type list of str
578 @param workdir path name of the working directory
579 @type str
580 @param discover flag indicating to discover the tests automatically
581 @type bool
582 @param discoveryStart directory to start auto-discovery at
583 @type str
584 @param testCases list of test cases to be loaded
585 @type list of str
586 @param debug flag indicating to run unittest with debugging
587 @type bool
588 """
589 return
590
591 def remoteUTRun(self, debug, failfast):
592 """
593 Public method to start a unittest run.
594
595 @param debug flag indicating to run unittest with debugging
596 @type bool
597 @param failfast flag indicating to stop at the first error
598 @type bool
599 """
600 return
601
602 def remoteUTStop(self):
603 """
604 public method to stop a unittest run.
605 """
606 return
607
608
609 def createDebuggerInterfaceNone(debugServer, passive):
610 """
611 Module function to create a debugger interface instance.
612
613
614 @param debugServer reference to the debug server
615 @type DebugServer
616 @param passive flag indicating passive connection mode
617 @type bool
618 @return instantiated debugger interface
619 @rtype DebuggerInterfaceNone
620 """
621 return DebuggerInterfaceNone(debugServer, passive)
622
623
624 def getRegistryData():
625 """
626 Module function to get characterizing data for the debugger interface.
627
628 @return list of tuples containing the client type, the client capabilities,
629 the client file type associations and a reference to the creation
630 function
631 @rtype list of tuple of (str, int, list of str, function)
632 """
633 return [("None", ClientDefaultCapabilities, ClientTypeAssociations,
634 createDebuggerInterfaceNone)]

eric ide

mercurial