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

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

eric ide

mercurial