src/eric7/Documentation/Source/eric7.DebugClients.Python.DebugClientBase.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 9097
213951c41dcd
child 9236
db53a9efe7ef
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.DebugClients.Python.DebugClientBase</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.DebugClients.Python.DebugClientBase</h1>
10
11 <p>
12 Module implementing a debug client base class.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>DebugClientInstance</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#DebugClientBase">DebugClientBase</a></td>
25 <td>Class implementing the client side of the debugger.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31
32 <tr>
33 <td><a href="#DebugClientClose">DebugClientClose</a></td>
34 <td>Replacement for the standard os.close(fd).</td>
35 </tr>
36 <tr>
37 <td><a href="#DebugClientInput">DebugClientInput</a></td>
38 <td>Replacement for the standard input() builtin.</td>
39 </tr>
40 <tr>
41 <td><a href="#DebugClientSetRecursionLimit">DebugClientSetRecursionLimit</a></td>
42 <td>Replacement for the standard sys.setrecursionlimit(limit).</td>
43 </tr>
44 </table>
45 <hr />
46 <hr />
47 <a NAME="DebugClientBase" ID="DebugClientBase"></a>
48 <h2>DebugClientBase</h2>
49
50 <p>
51 Class implementing the client side of the debugger.
52 </p>
53 <p>
54 It provides access to the Python interpeter from a debugger running in
55 another process.
56 </p>
57 <p>
58 The protocol between the debugger and the client is based on JSONRPC 2.0
59 PDUs. Each one is sent on a single line, i.e. commands or responses are
60 separated by a linefeed character.
61 </p>
62 <p>
63 If the debugger closes the session there is no response from the client.
64 The client may close the session at any time as a result of the script
65 being debugged closing or crashing.
66 </p>
67 <p>
68 <b>Note</b>: This class is meant to be subclassed by individual
69 DebugClient classes. Do not instantiate it directly.
70 </p>
71 <h3>Derived from</h3>
72 None
73 <h3>Class Attributes</h3>
74
75 <table>
76 <tr><td>Type2Indicators</td></tr><tr><td>clientCapabilities</td></tr>
77 </table>
78 <h3>Class Methods</h3>
79
80 <table>
81 <tr><td>None</td></tr>
82 </table>
83 <h3>Methods</h3>
84
85 <table>
86
87 <tr>
88 <td><a href="#DebugClientBase.__init__">DebugClientBase</a></td>
89 <td>Constructor</td>
90 </tr>
91 <tr>
92 <td><a href="#DebugClientBase.__clientCapabilities">__clientCapabilities</a></td>
93 <td>Private method to determine the clients capabilities.</td>
94 </tr>
95 <tr>
96 <td><a href="#DebugClientBase.__compileCommand">__compileCommand</a></td>
97 <td>Private method to compile source code.</td>
98 </tr>
99 <tr>
100 <td><a href="#DebugClientBase.__compileFileSource">__compileFileSource</a></td>
101 <td>Private method to compile source code read from a file.</td>
102 </tr>
103 <tr>
104 <td><a href="#DebugClientBase.__completionList">__completionList</a></td>
105 <td>Private slot to handle the request for a commandline completion list.</td>
106 </tr>
107 <tr>
108 <td><a href="#DebugClientBase.__dumpVariable">__dumpVariable</a></td>
109 <td>Private method to return the variables of a frame to the debug server.</td>
110 </tr>
111 <tr>
112 <td><a href="#DebugClientBase.__dumpVariables">__dumpVariables</a></td>
113 <td>Private method to return the variables of a frame to the debug server.</td>
114 </tr>
115 <tr>
116 <td><a href="#DebugClientBase.__formatVariablesList">__formatVariablesList</a></td>
117 <td>Private method to produce a formated variables list.</td>
118 </tr>
119 <tr>
120 <td><a href="#DebugClientBase.__generateFilterObjects">__generateFilterObjects</a></td>
121 <td>Private slot to convert a filter string to a list of filter objects.</td>
122 </tr>
123 <tr>
124 <td><a href="#DebugClientBase.__getCompletionList">__getCompletionList</a></td>
125 <td>Private method to create a completions list.</td>
126 </tr>
127 <tr>
128 <td><a href="#DebugClientBase.__getSysPath">__getSysPath</a></td>
129 <td>Private slot to calculate a path list including the PYTHONPATH environment variable.</td>
130 </tr>
131 <tr>
132 <td><a href="#DebugClientBase.__interact">__interact</a></td>
133 <td>Private method to interact with the debugger.</td>
134 </tr>
135 <tr>
136 <td><a href="#DebugClientBase.__interceptSignals">__interceptSignals</a></td>
137 <td>Private method to intercept common signals.</td>
138 </tr>
139 <tr>
140 <td><a href="#DebugClientBase.__resolveHost">__resolveHost</a></td>
141 <td>Private method to resolve a hostname to an IP address.</td>
142 </tr>
143 <tr>
144 <td><a href="#DebugClientBase.__setCoding">__setCoding</a></td>
145 <td>Private method to set the coding used by a python file.</td>
146 </tr>
147 <tr>
148 <td><a href="#DebugClientBase.__signalHandler">__signalHandler</a></td>
149 <td>Private method to handle signals.</td>
150 </tr>
151 <tr>
152 <td><a href="#DebugClientBase.__unhandled_exception">__unhandled_exception</a></td>
153 <td>Private method called to report an uncaught exception.</td>
154 </tr>
155 <tr>
156 <td><a href="#DebugClientBase.absPath">absPath</a></td>
157 <td>Public method to convert a filename to an absolute name.</td>
158 </tr>
159 <tr>
160 <td><a href="#DebugClientBase.close">close</a></td>
161 <td>Public method implementing a close method as a replacement for os.close().</td>
162 </tr>
163 <tr>
164 <td><a href="#DebugClientBase.connectDebugger">connectDebugger</a></td>
165 <td>Public method to establish a session with the debugger.</td>
166 </tr>
167 <tr>
168 <td><a href="#DebugClientBase.eventLoop">eventLoop</a></td>
169 <td>Public method implementing our event loop.</td>
170 </tr>
171 <tr>
172 <td><a href="#DebugClientBase.eventPoll">eventPoll</a></td>
173 <td>Public method to poll for events like 'set break point'.</td>
174 </tr>
175 <tr>
176 <td><a href="#DebugClientBase.getCoding">getCoding</a></td>
177 <td>Public method to return the current coding.</td>
178 </tr>
179 <tr>
180 <td><a href="#DebugClientBase.getRunning">getRunning</a></td>
181 <td>Public method to return the main script we are currently running.</td>
182 </tr>
183 <tr>
184 <td><a href="#DebugClientBase.handleJsonCommand">handleJsonCommand</a></td>
185 <td>Public method to handle a command serialized as a JSON string.</td>
186 </tr>
187 <tr>
188 <td><a href="#DebugClientBase.input">input</a></td>
189 <td>Public method to implement input() using the event loop.</td>
190 </tr>
191 <tr>
192 <td><a href="#DebugClientBase.main">main</a></td>
193 <td>Public method implementing the main method.</td>
194 </tr>
195 <tr>
196 <td><a href="#DebugClientBase.progTerminated">progTerminated</a></td>
197 <td>Public method to tell the debugger that the program has terminated.</td>
198 </tr>
199 <tr>
200 <td><a href="#DebugClientBase.readReady">readReady</a></td>
201 <td>Public method called when there is data ready to be read.</td>
202 </tr>
203 <tr>
204 <td><a href="#DebugClientBase.run_call">run_call</a></td>
205 <td>Public method used to start the remote debugger and call a function.</td>
206 </tr>
207 <tr>
208 <td><a href="#DebugClientBase.sendCallTrace">sendCallTrace</a></td>
209 <td>Public method to send a call trace entry.</td>
210 </tr>
211 <tr>
212 <td><a href="#DebugClientBase.sendClearTemporaryBreakpoint">sendClearTemporaryBreakpoint</a></td>
213 <td>Public method to signal the deletion of a temporary breakpoint.</td>
214 </tr>
215 <tr>
216 <td><a href="#DebugClientBase.sendClearTemporaryWatch">sendClearTemporaryWatch</a></td>
217 <td>Public method to signal the deletion of a temporary watch expression.</td>
218 </tr>
219 <tr>
220 <td><a href="#DebugClientBase.sendDebuggerId">sendDebuggerId</a></td>
221 <td>Public method to send the debug client id.</td>
222 </tr>
223 <tr>
224 <td><a href="#DebugClientBase.sendException">sendException</a></td>
225 <td>Public method to send information for an exception.</td>
226 </tr>
227 <tr>
228 <td><a href="#DebugClientBase.sendJsonCommand">sendJsonCommand</a></td>
229 <td>Public method to send a single command or response to the IDE.</td>
230 </tr>
231 <tr>
232 <td><a href="#DebugClientBase.sendPassiveStartup">sendPassiveStartup</a></td>
233 <td>Public method to send the passive start information.</td>
234 </tr>
235 <tr>
236 <td><a href="#DebugClientBase.sendResponseLine">sendResponseLine</a></td>
237 <td>Public method to send the current call stack.</td>
238 </tr>
239 <tr>
240 <td><a href="#DebugClientBase.sendSyntaxError">sendSyntaxError</a></td>
241 <td>Public method to send information for a syntax error.</td>
242 </tr>
243 <tr>
244 <td><a href="#DebugClientBase.sessionClose">sessionClose</a></td>
245 <td>Public method to close the session with the debugger and optionally terminate.</td>
246 </tr>
247 <tr>
248 <td><a href="#DebugClientBase.setDisassembly">setDisassembly</a></td>
249 <td>Public method to store a disassembly of the code object raising an exception.</td>
250 </tr>
251 <tr>
252 <td><a href="#DebugClientBase.skipMultiProcessDebugging">skipMultiProcessDebugging</a></td>
253 <td>Public method to check, if the given script is eligible for debugging.</td>
254 </tr>
255 <tr>
256 <td><a href="#DebugClientBase.startDebugger">startDebugger</a></td>
257 <td>Public method used to start the remote debugger.</td>
258 </tr>
259 <tr>
260 <td><a href="#DebugClientBase.startProgInDebugger">startProgInDebugger</a></td>
261 <td>Public method used to start the remote debugger.</td>
262 </tr>
263 <tr>
264 <td><a href="#DebugClientBase.writeReady">writeReady</a></td>
265 <td>Public method called when we are ready to write data.</td>
266 </tr>
267 </table>
268 <h3>Static Methods</h3>
269
270 <table>
271 <tr><td>None</td></tr>
272 </table>
273
274 <a NAME="DebugClientBase.__init__" ID="DebugClientBase.__init__"></a>
275 <h4>DebugClientBase (Constructor)</h4>
276 <b>DebugClientBase</b>(<i></i>)
277
278 <p>
279 Constructor
280 </p>
281 <a NAME="DebugClientBase.__clientCapabilities" ID="DebugClientBase.__clientCapabilities"></a>
282 <h4>DebugClientBase.__clientCapabilities</h4>
283 <b>__clientCapabilities</b>(<i></i>)
284
285 <p>
286 Private method to determine the clients capabilities.
287 </p>
288 <dl>
289 <dt>Return:</dt>
290 <dd>
291 client capabilities (integer)
292 </dd>
293 </dl>
294 <a NAME="DebugClientBase.__compileCommand" ID="DebugClientBase.__compileCommand"></a>
295 <h4>DebugClientBase.__compileCommand</h4>
296 <b>__compileCommand</b>(<i>statement, filename="<string>", mode="exec"</i>)
297
298 <p>
299 Private method to compile source code.
300 </p>
301 <dl>
302
303 <dt><i>statement</i> (str)</dt>
304 <dd>
305 source code string to be compiled
306 </dd>
307 <dt><i>filename</i> (str)</dt>
308 <dd>
309 name of the source file
310 </dd>
311 <dt><i>mode</i> (str)</dt>
312 <dd>
313 kind of code to be generated (exec or eval)
314 </dd>
315 </dl>
316 <dl>
317 <dt>Return:</dt>
318 <dd>
319 compiled code object (None in case of errors)
320 </dd>
321 </dl>
322 <a NAME="DebugClientBase.__compileFileSource" ID="DebugClientBase.__compileFileSource"></a>
323 <h4>DebugClientBase.__compileFileSource</h4>
324 <b>__compileFileSource</b>(<i>filename, mode='exec'</i>)
325
326 <p>
327 Private method to compile source code read from a file.
328 </p>
329 <dl>
330
331 <dt><i>filename</i> (str)</dt>
332 <dd>
333 name of the source file
334 </dd>
335 <dt><i>mode</i> (str)</dt>
336 <dd>
337 kind of code to be generated (exec or eval)
338 </dd>
339 </dl>
340 <dl>
341 <dt>Return:</dt>
342 <dd>
343 compiled code object (None in case of errors)
344 </dd>
345 </dl>
346 <a NAME="DebugClientBase.__completionList" ID="DebugClientBase.__completionList"></a>
347 <h4>DebugClientBase.__completionList</h4>
348 <b>__completionList</b>(<i>text</i>)
349
350 <p>
351 Private slot to handle the request for a commandline completion list.
352 </p>
353 <dl>
354
355 <dt><i>text</i></dt>
356 <dd>
357 the text to be completed (string)
358 </dd>
359 </dl>
360 <a NAME="DebugClientBase.__dumpVariable" ID="DebugClientBase.__dumpVariable"></a>
361 <h4>DebugClientBase.__dumpVariable</h4>
362 <b>__dumpVariable</b>(<i>var, frmnr, scope, filterList</i>)
363
364 <p>
365 Private method to return the variables of a frame to the debug server.
366 </p>
367 <dl>
368
369 <dt><i>var</i> (list of str)</dt>
370 <dd>
371 list encoded name of the requested variable
372 </dd>
373 <dt><i>frmnr</i> (int)</dt>
374 <dd>
375 distance of frame reported on. 0 is the current frame
376 </dd>
377 <dt><i>scope</i> (int)</dt>
378 <dd>
379 1 to report global variables, 0 for local variables
380 </dd>
381 <dt><i>filterList</i> (list of int)</dt>
382 <dd>
383 list of variable types to be filtered
384 </dd>
385 </dl>
386 <a NAME="DebugClientBase.__dumpVariables" ID="DebugClientBase.__dumpVariables"></a>
387 <h4>DebugClientBase.__dumpVariables</h4>
388 <b>__dumpVariables</b>(<i>frmnr, scope, filterList</i>)
389
390 <p>
391 Private method to return the variables of a frame to the debug server.
392 </p>
393 <dl>
394
395 <dt><i>frmnr</i> (int)</dt>
396 <dd>
397 distance of frame reported on. 0 is the current frame
398 </dd>
399 <dt><i>scope</i> (int)</dt>
400 <dd>
401 1 to report global variables, 0 for local variables
402 </dd>
403 <dt><i>filterList</i> (list of str)</dt>
404 <dd>
405 list of variable types to be filtered
406 </dd>
407 </dl>
408 <a NAME="DebugClientBase.__formatVariablesList" ID="DebugClientBase.__formatVariablesList"></a>
409 <h4>DebugClientBase.__formatVariablesList</h4>
410 <b>__formatVariablesList</b>(<i>variables, scope, filterList=None</i>)
411
412 <p>
413 Private method to produce a formated variables list.
414 </p>
415 <p>
416 The dictionary passed in to it is scanned. Variables are
417 only added to the list, if their type is not contained
418 in the filter list and their name doesn't match any of the filter
419 expressions. The formated variables list (a list of tuples of 3
420 values) is returned.
421 </p>
422 <dl>
423
424 <dt><i>variables</i> (list of tuple of (str, Any) or (str, str, Any))</dt>
425 <dd>
426 variables list to be processed
427 </dd>
428 <dt><i>scope</i> (int)</dt>
429 <dd>
430 1 to filter using the globals filter, 0 using the locals
431 filter.
432 Variables are only added to the list, if their name do not match
433 any of the filter expressions.
434 </dd>
435 <dt><i>filterList</i> (list of str)</dt>
436 <dd>
437 list of variable types to be filtered.
438 Variables are only added to the list, if their type is not
439 contained in the filter list.
440 </dd>
441 </dl>
442 <dl>
443 <dt>Return:</dt>
444 <dd>
445 A tuple consisting of a list of formatted variables. Each
446 variable entry is a tuple of three elements, the variable name,
447 its type and value.
448 </dd>
449 </dl>
450 <dl>
451 <dt>Return Type:</dt>
452 <dd>
453 list of tuple of (str, str, str)
454 </dd>
455 </dl>
456 <a NAME="DebugClientBase.__generateFilterObjects" ID="DebugClientBase.__generateFilterObjects"></a>
457 <h4>DebugClientBase.__generateFilterObjects</h4>
458 <b>__generateFilterObjects</b>(<i>scope, filterString</i>)
459
460 <p>
461 Private slot to convert a filter string to a list of filter objects.
462 </p>
463 <dl>
464
465 <dt><i>scope</i></dt>
466 <dd>
467 1 to generate filter for global variables, 0 for local
468 variables (int)
469 </dd>
470 <dt><i>filterString</i></dt>
471 <dd>
472 string of filter patterns separated by ';'
473 </dd>
474 </dl>
475 <a NAME="DebugClientBase.__getCompletionList" ID="DebugClientBase.__getCompletionList"></a>
476 <h4>DebugClientBase.__getCompletionList</h4>
477 <b>__getCompletionList</b>(<i>text, completer, completions</i>)
478
479 <p>
480 Private method to create a completions list.
481 </p>
482 <dl>
483
484 <dt><i>text</i></dt>
485 <dd>
486 text to complete (string)
487 </dd>
488 <dt><i>completer</i></dt>
489 <dd>
490 completer method
491 </dd>
492 <dt><i>completions</i></dt>
493 <dd>
494 set where to add new completions strings (set)
495 </dd>
496 </dl>
497 <a NAME="DebugClientBase.__getSysPath" ID="DebugClientBase.__getSysPath"></a>
498 <h4>DebugClientBase.__getSysPath</h4>
499 <b>__getSysPath</b>(<i>firstEntry</i>)
500
501 <p>
502 Private slot to calculate a path list including the PYTHONPATH
503 environment variable.
504 </p>
505 <dl>
506
507 <dt><i>firstEntry</i></dt>
508 <dd>
509 entry to be put first in sys.path (string)
510 </dd>
511 </dl>
512 <dl>
513 <dt>Return:</dt>
514 <dd>
515 path list for use as sys.path (list of strings)
516 </dd>
517 </dl>
518 <a NAME="DebugClientBase.__interact" ID="DebugClientBase.__interact"></a>
519 <h4>DebugClientBase.__interact</h4>
520 <b>__interact</b>(<i></i>)
521
522 <p>
523 Private method to interact with the debugger.
524 </p>
525 <a NAME="DebugClientBase.__interceptSignals" ID="DebugClientBase.__interceptSignals"></a>
526 <h4>DebugClientBase.__interceptSignals</h4>
527 <b>__interceptSignals</b>(<i></i>)
528
529 <p>
530 Private method to intercept common signals.
531 </p>
532 <a NAME="DebugClientBase.__resolveHost" ID="DebugClientBase.__resolveHost"></a>
533 <h4>DebugClientBase.__resolveHost</h4>
534 <b>__resolveHost</b>(<i>host</i>)
535
536 <p>
537 Private method to resolve a hostname to an IP address.
538 </p>
539 <dl>
540
541 <dt><i>host</i></dt>
542 <dd>
543 hostname of the debug server (string)
544 </dd>
545 </dl>
546 <dl>
547 <dt>Return:</dt>
548 <dd>
549 IP address (string)
550 </dd>
551 </dl>
552 <a NAME="DebugClientBase.__setCoding" ID="DebugClientBase.__setCoding"></a>
553 <h4>DebugClientBase.__setCoding</h4>
554 <b>__setCoding</b>(<i>filename</i>)
555
556 <p>
557 Private method to set the coding used by a python file.
558 </p>
559 <dl>
560
561 <dt><i>filename</i></dt>
562 <dd>
563 name of the file to inspect (string)
564 </dd>
565 </dl>
566 <a NAME="DebugClientBase.__signalHandler" ID="DebugClientBase.__signalHandler"></a>
567 <h4>DebugClientBase.__signalHandler</h4>
568 <b>__signalHandler</b>(<i>signalNumber, stackFrame</i>)
569
570 <p>
571 Private method to handle signals.
572 </p>
573 <dl>
574
575 <dt><i>signalNumber</i> (int)</dt>
576 <dd>
577 number of the signal to be handled
578 </dd>
579 <dt><i>stackFrame</i> (frame object)</dt>
580 <dd>
581 current stack frame
582 </dd>
583 </dl>
584 <a NAME="DebugClientBase.__unhandled_exception" ID="DebugClientBase.__unhandled_exception"></a>
585 <h4>DebugClientBase.__unhandled_exception</h4>
586 <b>__unhandled_exception</b>(<i>exctype, excval, exctb</i>)
587
588 <p>
589 Private method called to report an uncaught exception.
590 </p>
591 <dl>
592
593 <dt><i>exctype</i></dt>
594 <dd>
595 the type of the exception
596 </dd>
597 <dt><i>excval</i></dt>
598 <dd>
599 data about the exception
600 </dd>
601 <dt><i>exctb</i></dt>
602 <dd>
603 traceback for the exception
604 </dd>
605 </dl>
606 <a NAME="DebugClientBase.absPath" ID="DebugClientBase.absPath"></a>
607 <h4>DebugClientBase.absPath</h4>
608 <b>absPath</b>(<i>fn</i>)
609
610 <p>
611 Public method to convert a filename to an absolute name.
612 </p>
613 <p>
614 sys.path is used as a set of possible prefixes. The name stays
615 relative if a file could not be found.
616 </p>
617 <dl>
618
619 <dt><i>fn</i></dt>
620 <dd>
621 filename (string)
622 </dd>
623 </dl>
624 <dl>
625 <dt>Return:</dt>
626 <dd>
627 the converted filename (string)
628 </dd>
629 </dl>
630 <a NAME="DebugClientBase.close" ID="DebugClientBase.close"></a>
631 <h4>DebugClientBase.close</h4>
632 <b>close</b>(<i>fd</i>)
633
634 <p>
635 Public method implementing a close method as a replacement for
636 os.close().
637 </p>
638 <p>
639 It prevents the debugger connections from being closed.
640 </p>
641 <dl>
642
643 <dt><i>fd</i></dt>
644 <dd>
645 file descriptor to be closed (integer)
646 </dd>
647 </dl>
648 <a NAME="DebugClientBase.connectDebugger" ID="DebugClientBase.connectDebugger"></a>
649 <h4>DebugClientBase.connectDebugger</h4>
650 <b>connectDebugger</b>(<i>port, remoteAddress=None, redirect=True, name=""</i>)
651
652 <p>
653 Public method to establish a session with the debugger.
654 </p>
655 <p>
656 It opens a network connection to the debugger, connects it to stdin,
657 stdout and stderr and saves these file objects in case the application
658 being debugged redirects them itself.
659 </p>
660 <dl>
661
662 <dt><i>port</i> (int)</dt>
663 <dd>
664 the port number to connect to
665 </dd>
666 <dt><i>remoteAddress</i> (str)</dt>
667 <dd>
668 the network address of the debug server host
669 </dd>
670 <dt><i>redirect</i> (bool)</dt>
671 <dd>
672 flag indicating redirection of stdin, stdout and
673 stderr
674 </dd>
675 <dt><i>name</i> (str)</dt>
676 <dd>
677 name to be attached to the debugger ID
678 </dd>
679 </dl>
680 <a NAME="DebugClientBase.eventLoop" ID="DebugClientBase.eventLoop"></a>
681 <h4>DebugClientBase.eventLoop</h4>
682 <b>eventLoop</b>(<i>disablePolling=False</i>)
683
684 <p>
685 Public method implementing our event loop.
686 </p>
687 <dl>
688
689 <dt><i>disablePolling</i></dt>
690 <dd>
691 flag indicating to enter an event loop with
692 polling disabled (boolean)
693 </dd>
694 </dl>
695 <a NAME="DebugClientBase.eventPoll" ID="DebugClientBase.eventPoll"></a>
696 <h4>DebugClientBase.eventPoll</h4>
697 <b>eventPoll</b>(<i></i>)
698
699 <p>
700 Public method to poll for events like 'set break point'.
701 </p>
702 <a NAME="DebugClientBase.getCoding" ID="DebugClientBase.getCoding"></a>
703 <h4>DebugClientBase.getCoding</h4>
704 <b>getCoding</b>(<i></i>)
705
706 <p>
707 Public method to return the current coding.
708 </p>
709 <dl>
710 <dt>Return:</dt>
711 <dd>
712 codec name (string)
713 </dd>
714 </dl>
715 <a NAME="DebugClientBase.getRunning" ID="DebugClientBase.getRunning"></a>
716 <h4>DebugClientBase.getRunning</h4>
717 <b>getRunning</b>(<i></i>)
718
719 <p>
720 Public method to return the main script we are currently running.
721 </p>
722 <dl>
723 <dt>Return:</dt>
724 <dd>
725 flag indicating a running debug session (boolean)
726 </dd>
727 </dl>
728 <a NAME="DebugClientBase.handleJsonCommand" ID="DebugClientBase.handleJsonCommand"></a>
729 <h4>DebugClientBase.handleJsonCommand</h4>
730 <b>handleJsonCommand</b>(<i>jsonStr</i>)
731
732 <p>
733 Public method to handle a command serialized as a JSON string.
734 </p>
735 <dl>
736
737 <dt><i>jsonStr</i> (str)</dt>
738 <dd>
739 string containing the command received from the IDE
740 </dd>
741 </dl>
742 <a NAME="DebugClientBase.input" ID="DebugClientBase.input"></a>
743 <h4>DebugClientBase.input</h4>
744 <b>input</b>(<i>prompt, echo=True</i>)
745
746 <p>
747 Public method to implement input() using the event loop.
748 </p>
749 <dl>
750
751 <dt><i>prompt</i> (str)</dt>
752 <dd>
753 prompt to be shown
754 </dd>
755 <dt><i>echo</i> (bool)</dt>
756 <dd>
757 flag indicating echoing of the input
758 </dd>
759 </dl>
760 <dl>
761 <dt>Return:</dt>
762 <dd>
763 the entered string
764 </dd>
765 </dl>
766 <dl>
767 <dt>Return Type:</dt>
768 <dd>
769 str
770 </dd>
771 </dl>
772 <a NAME="DebugClientBase.main" ID="DebugClientBase.main"></a>
773 <h4>DebugClientBase.main</h4>
774 <b>main</b>(<i></i>)
775
776 <p>
777 Public method implementing the main method.
778 </p>
779 <a NAME="DebugClientBase.progTerminated" ID="DebugClientBase.progTerminated"></a>
780 <h4>DebugClientBase.progTerminated</h4>
781 <b>progTerminated</b>(<i>status, message="", closeSession=True</i>)
782
783 <p>
784 Public method to tell the debugger that the program has terminated.
785 </p>
786 <dl>
787
788 <dt><i>status</i> (int)</dt>
789 <dd>
790 return status
791 </dd>
792 <dt><i>message</i> (str)</dt>
793 <dd>
794 status message
795 </dd>
796 <dt><i>closeSession</i> (bool)</dt>
797 <dd>
798 flag indicating to close the debugger session
799 </dd>
800 </dl>
801 <a NAME="DebugClientBase.readReady" ID="DebugClientBase.readReady"></a>
802 <h4>DebugClientBase.readReady</h4>
803 <b>readReady</b>(<i>stream</i>)
804
805 <p>
806 Public method called when there is data ready to be read.
807 </p>
808 <dl>
809
810 <dt><i>stream</i></dt>
811 <dd>
812 file like object that has data to be read
813 </dd>
814 </dl>
815 <dl>
816 <dt>Return:</dt>
817 <dd>
818 flag indicating an error condition
819 </dd>
820 </dl>
821 <dl>
822 <dt>Return Type:</dt>
823 <dd>
824 bool
825 </dd>
826 </dl>
827 <a NAME="DebugClientBase.run_call" ID="DebugClientBase.run_call"></a>
828 <h4>DebugClientBase.run_call</h4>
829 <b>run_call</b>(<i>scriptname, func, *args</i>)
830
831 <p>
832 Public method used to start the remote debugger and call a function.
833 </p>
834 <dl>
835
836 <dt><i>scriptname</i></dt>
837 <dd>
838 name of the script to be debugged (string)
839 </dd>
840 <dt><i>func</i></dt>
841 <dd>
842 function to be called
843 </dd>
844 <dt><i>*args</i></dt>
845 <dd>
846 arguments being passed to func
847 </dd>
848 </dl>
849 <dl>
850 <dt>Return:</dt>
851 <dd>
852 result of the function call
853 </dd>
854 </dl>
855 <a NAME="DebugClientBase.sendCallTrace" ID="DebugClientBase.sendCallTrace"></a>
856 <h4>DebugClientBase.sendCallTrace</h4>
857 <b>sendCallTrace</b>(<i>event, fromInfo, toInfo</i>)
858
859 <p>
860 Public method to send a call trace entry.
861 </p>
862 <dl>
863
864 <dt><i>event</i> (str)</dt>
865 <dd>
866 trace event (call or return)
867 </dd>
868 <dt><i>fromInfo</i> (dict with 'filename', 'linenumber' and 'codename')</dt>
869 <dd>
870 dictionary containing the origin info
871 as keys
872 </dd>
873 <dt><i>toInfo</i> (dict with 'filename', 'linenumber' and 'codename')</dt>
874 <dd>
875 dictionary containing the target info
876 as keys
877 </dd>
878 </dl>
879 <a NAME="DebugClientBase.sendClearTemporaryBreakpoint" ID="DebugClientBase.sendClearTemporaryBreakpoint"></a>
880 <h4>DebugClientBase.sendClearTemporaryBreakpoint</h4>
881 <b>sendClearTemporaryBreakpoint</b>(<i>filename, lineno</i>)
882
883 <p>
884 Public method to signal the deletion of a temporary breakpoint.
885 </p>
886 <dl>
887
888 <dt><i>filename</i> (str)</dt>
889 <dd>
890 name of the file the bp belongs to
891 </dd>
892 <dt><i>lineno</i> (int)</dt>
893 <dd>
894 linenumber of the bp
895 </dd>
896 </dl>
897 <a NAME="DebugClientBase.sendClearTemporaryWatch" ID="DebugClientBase.sendClearTemporaryWatch"></a>
898 <h4>DebugClientBase.sendClearTemporaryWatch</h4>
899 <b>sendClearTemporaryWatch</b>(<i>condition</i>)
900
901 <p>
902 Public method to signal the deletion of a temporary watch expression.
903 </p>
904 <dl>
905
906 <dt><i>condition</i> (str)</dt>
907 <dd>
908 condition of the watch expression to be cleared
909 </dd>
910 </dl>
911 <a NAME="DebugClientBase.sendDebuggerId" ID="DebugClientBase.sendDebuggerId"></a>
912 <h4>DebugClientBase.sendDebuggerId</h4>
913 <b>sendDebuggerId</b>(<i>debuggerId</i>)
914
915 <p>
916 Public method to send the debug client id.
917 </p>
918 <dl>
919
920 <dt><i>debuggerId</i> (str)</dt>
921 <dd>
922 id of this debug client instance (made up of
923 hostname and process ID)
924 </dd>
925 </dl>
926 <a NAME="DebugClientBase.sendException" ID="DebugClientBase.sendException"></a>
927 <h4>DebugClientBase.sendException</h4>
928 <b>sendException</b>(<i>exceptionType, exceptionMessage, stack, threadName</i>)
929
930 <p>
931 Public method to send information for an exception.
932 </p>
933 <dl>
934
935 <dt><i>exceptionType</i> (str)</dt>
936 <dd>
937 type of exception raised
938 </dd>
939 <dt><i>exceptionMessage</i> (str)</dt>
940 <dd>
941 message of the exception
942 </dd>
943 <dt><i>stack</i> (list)</dt>
944 <dd>
945 stack trace information
946 </dd>
947 <dt><i>threadName</i> (str)</dt>
948 <dd>
949 name of the thread sending the event
950 </dd>
951 </dl>
952 <a NAME="DebugClientBase.sendJsonCommand" ID="DebugClientBase.sendJsonCommand"></a>
953 <h4>DebugClientBase.sendJsonCommand</h4>
954 <b>sendJsonCommand</b>(<i>method, params</i>)
955
956 <p>
957 Public method to send a single command or response to the IDE.
958 </p>
959 <dl>
960
961 <dt><i>method</i> (str)</dt>
962 <dd>
963 command or response command name to be sent
964 </dd>
965 <dt><i>params</i> (dict)</dt>
966 <dd>
967 dictionary of named parameters for the command or
968 response
969 </dd>
970 </dl>
971 <a NAME="DebugClientBase.sendPassiveStartup" ID="DebugClientBase.sendPassiveStartup"></a>
972 <h4>DebugClientBase.sendPassiveStartup</h4>
973 <b>sendPassiveStartup</b>(<i>filename, exceptions</i>)
974
975 <p>
976 Public method to send the passive start information.
977 </p>
978 <dl>
979
980 <dt><i>filename</i> (str)</dt>
981 <dd>
982 name of the script
983 </dd>
984 <dt><i>exceptions</i> (bool)</dt>
985 <dd>
986 flag to enable exception reporting of the IDE
987 </dd>
988 </dl>
989 <a NAME="DebugClientBase.sendResponseLine" ID="DebugClientBase.sendResponseLine"></a>
990 <h4>DebugClientBase.sendResponseLine</h4>
991 <b>sendResponseLine</b>(<i>stack, threadName</i>)
992
993 <p>
994 Public method to send the current call stack.
995 </p>
996 <dl>
997
998 <dt><i>stack</i> (list)</dt>
999 <dd>
1000 call stack
1001 </dd>
1002 <dt><i>threadName</i> (str)</dt>
1003 <dd>
1004 name of the thread sending the event
1005 </dd>
1006 </dl>
1007 <a NAME="DebugClientBase.sendSyntaxError" ID="DebugClientBase.sendSyntaxError"></a>
1008 <h4>DebugClientBase.sendSyntaxError</h4>
1009 <b>sendSyntaxError</b>(<i>message, filename, lineno, charno, threadName</i>)
1010
1011 <p>
1012 Public method to send information for a syntax error.
1013 </p>
1014 <dl>
1015
1016 <dt><i>message</i> (str)</dt>
1017 <dd>
1018 syntax error message
1019 </dd>
1020 <dt><i>filename</i> (str)</dt>
1021 <dd>
1022 name of the faulty file
1023 </dd>
1024 <dt><i>lineno</i> (int)</dt>
1025 <dd>
1026 line number info
1027 </dd>
1028 <dt><i>charno</i> (int)</dt>
1029 <dd>
1030 character number info
1031 </dd>
1032 <dt><i>threadName</i> (str)</dt>
1033 <dd>
1034 name of the thread sending the event
1035 </dd>
1036 </dl>
1037 <a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a>
1038 <h4>DebugClientBase.sessionClose</h4>
1039 <b>sessionClose</b>(<i>terminate=True</i>)
1040
1041 <p>
1042 Public method to close the session with the debugger and optionally
1043 terminate.
1044 </p>
1045 <dl>
1046
1047 <dt><i>terminate</i></dt>
1048 <dd>
1049 flag indicating to terminate (boolean)
1050 </dd>
1051 </dl>
1052 <a NAME="DebugClientBase.setDisassembly" ID="DebugClientBase.setDisassembly"></a>
1053 <h4>DebugClientBase.setDisassembly</h4>
1054 <b>setDisassembly</b>(<i>disassembly</i>)
1055
1056 <p>
1057 Public method to store a disassembly of the code object raising an
1058 exception.
1059 </p>
1060 <dl>
1061
1062 <dt><i>disassembly</i> (dict)</dt>
1063 <dd>
1064 dictionary containing the disassembly information
1065 </dd>
1066 </dl>
1067 <a NAME="DebugClientBase.skipMultiProcessDebugging" ID="DebugClientBase.skipMultiProcessDebugging"></a>
1068 <h4>DebugClientBase.skipMultiProcessDebugging</h4>
1069 <b>skipMultiProcessDebugging</b>(<i>scriptName</i>)
1070
1071 <p>
1072 Public method to check, if the given script is eligible for debugging.
1073 </p>
1074 <dl>
1075
1076 <dt><i>scriptName</i> (str)</dt>
1077 <dd>
1078 name of the script to check
1079 </dd>
1080 </dl>
1081 <dl>
1082 <dt>Return:</dt>
1083 <dd>
1084 flag indicating eligibility
1085 </dd>
1086 </dl>
1087 <dl>
1088 <dt>Return Type:</dt>
1089 <dd>
1090 bool
1091 </dd>
1092 </dl>
1093 <a NAME="DebugClientBase.startDebugger" ID="DebugClientBase.startDebugger"></a>
1094 <h4>DebugClientBase.startDebugger</h4>
1095 <b>startDebugger</b>(<i>filename=None, host=None, port=None, enableTrace=True, exceptions=True, tracePython=False, redirect=True, passive=True, multiprocessSupport=False</i>)
1096
1097 <p>
1098 Public method used to start the remote debugger.
1099 </p>
1100 <dl>
1101
1102 <dt><i>filename</i> (str)</dt>
1103 <dd>
1104 the program to be debugged
1105 </dd>
1106 <dt><i>host</i> (str)</dt>
1107 <dd>
1108 hostname of the debug server
1109 </dd>
1110 <dt><i>port</i> (int)</dt>
1111 <dd>
1112 portnumber of the debug server
1113 </dd>
1114 <dt><i>enableTrace</i> (bool)</dt>
1115 <dd>
1116 flag to enable the tracing function
1117 </dd>
1118 <dt><i>exceptions</i> (bool)</dt>
1119 <dd>
1120 flag to enable exception reporting of the IDE
1121 </dd>
1122 <dt><i>tracePython</i> (bool)</dt>
1123 <dd>
1124 flag to enable tracing into the Python library
1125 </dd>
1126 <dt><i>redirect</i> (bool)</dt>
1127 <dd>
1128 flag indicating redirection of stdin, stdout and
1129 stderr
1130 </dd>
1131 <dt><i>passive</i> (bool)</dt>
1132 <dd>
1133 flag indicating a passive debugging session
1134 </dd>
1135 <dt><i>multiprocessSupport</i> (bool)</dt>
1136 <dd>
1137 flag indicating to enable multiprocess
1138 debugging support
1139 </dd>
1140 </dl>
1141 <a NAME="DebugClientBase.startProgInDebugger" ID="DebugClientBase.startProgInDebugger"></a>
1142 <h4>DebugClientBase.startProgInDebugger</h4>
1143 <b>startProgInDebugger</b>(<i>progargs, wd='', host=None, port=None, exceptions=True, tracePython=False, redirect=True, passive=True, multiprocessSupport=False, codeStr="", scriptModule=""</i>)
1144
1145 <p>
1146 Public method used to start the remote debugger.
1147 </p>
1148 <dl>
1149
1150 <dt><i>progargs</i></dt>
1151 <dd>
1152 commandline for the program to be debugged
1153 (list of strings)
1154 </dd>
1155 <dt><i>wd</i></dt>
1156 <dd>
1157 working directory for the program execution (string)
1158 </dd>
1159 <dt><i>host</i></dt>
1160 <dd>
1161 hostname of the debug server (string)
1162 </dd>
1163 <dt><i>port</i></dt>
1164 <dd>
1165 portnumber of the debug server (int)
1166 </dd>
1167 <dt><i>exceptions</i></dt>
1168 <dd>
1169 flag to enable exception reporting of the IDE
1170 (boolean)
1171 </dd>
1172 <dt><i>tracePython</i></dt>
1173 <dd>
1174 flag to enable tracing into the Python library
1175 (boolean)
1176 </dd>
1177 <dt><i>redirect</i></dt>
1178 <dd>
1179 flag indicating redirection of stdin, stdout and
1180 stderr (boolean)
1181 </dd>
1182 <dt><i>passive</i> (bool)</dt>
1183 <dd>
1184 flag indicating a passive debugging session
1185 </dd>
1186 <dt><i>multiprocessSupport</i> (bool)</dt>
1187 <dd>
1188 flag indicating to enable multiprocess
1189 debugging support
1190 </dd>
1191 <dt><i>codeStr</i> (str)</dt>
1192 <dd>
1193 string containing Python code to execute
1194 </dd>
1195 <dt><i>scriptModule</i> (str)</dt>
1196 <dd>
1197 name of a module to be executed as a script
1198 </dd>
1199 </dl>
1200 <dl>
1201 <dt>Return:</dt>
1202 <dd>
1203 exit code of the debugged program
1204 </dd>
1205 </dl>
1206 <dl>
1207 <dt>Return Type:</dt>
1208 <dd>
1209 int
1210 </dd>
1211 </dl>
1212 <a NAME="DebugClientBase.writeReady" ID="DebugClientBase.writeReady"></a>
1213 <h4>DebugClientBase.writeReady</h4>
1214 <b>writeReady</b>(<i>stream</i>)
1215
1216 <p>
1217 Public method called when we are ready to write data.
1218 </p>
1219 <dl>
1220
1221 <dt><i>stream</i></dt>
1222 <dd>
1223 file like object that has data to be written
1224 </dd>
1225 </dl>
1226 <div align="right"><a href="#top">Up</a></div>
1227 <hr />
1228 <hr />
1229 <a NAME="DebugClientClose" ID="DebugClientClose"></a>
1230 <h2>DebugClientClose</h2>
1231 <b>DebugClientClose</b>(<i>fd</i>)
1232
1233 <p>
1234 Replacement for the standard os.close(fd).
1235 </p>
1236 <dl>
1237
1238 <dt><i>fd</i></dt>
1239 <dd>
1240 open file descriptor to be closed (integer)
1241 </dd>
1242 </dl>
1243 <div align="right"><a href="#top">Up</a></div>
1244 <hr />
1245 <hr />
1246 <a NAME="DebugClientInput" ID="DebugClientInput"></a>
1247 <h2>DebugClientInput</h2>
1248 <b>DebugClientInput</b>(<i>prompt="", echo=True</i>)
1249
1250 <p>
1251 Replacement for the standard input() builtin.
1252 </p>
1253 <p>
1254 This function works with the split debugger.
1255 </p>
1256 <dl>
1257
1258 <dt><i>prompt</i> (str)</dt>
1259 <dd>
1260 prompt to be shown
1261 </dd>
1262 <dt><i>echo</i> (bool)</dt>
1263 <dd>
1264 flag indicating echoing of the input
1265 </dd>
1266 </dl>
1267 <dl>
1268 <dt>Return:</dt>
1269 <dd>
1270 result of the input() call
1271 </dd>
1272 </dl>
1273 <dl>
1274 <dt>Return Type:</dt>
1275 <dd>
1276 str
1277 </dd>
1278 </dl>
1279 <div align="right"><a href="#top">Up</a></div>
1280 <hr />
1281 <hr />
1282 <a NAME="DebugClientSetRecursionLimit" ID="DebugClientSetRecursionLimit"></a>
1283 <h2>DebugClientSetRecursionLimit</h2>
1284 <b>DebugClientSetRecursionLimit</b>(<i>limit</i>)
1285
1286 <p>
1287 Replacement for the standard sys.setrecursionlimit(limit).
1288 </p>
1289 <dl>
1290
1291 <dt><i>limit</i></dt>
1292 <dd>
1293 recursion limit (integer)
1294 </dd>
1295 </dl>
1296 <div align="right"><a href="#top">Up</a></div>
1297 <hr />
1298 </body></html>

eric ide

mercurial