54 <a NAME="DebugClientBase" ID="DebugClientBase"></a> |
54 <a NAME="DebugClientBase" ID="DebugClientBase"></a> |
55 <h2>DebugClientBase</h2> |
55 <h2>DebugClientBase</h2> |
56 <p> |
56 <p> |
57 Class implementing the client side of the debugger. |
57 Class implementing the client side of the debugger. |
58 </p><p> |
58 </p><p> |
59 It provides access to the Python interpeter from a debugger running in another |
59 It provides access to the Python interpeter from a debugger running in |
60 process whether or not the Qt event loop is running. |
60 another process whether or not the Qt event loop is running. |
61 </p><p> |
61 </p><p> |
62 The protocol between the debugger and the client assumes that there will be |
62 The protocol between the debugger and the client assumes that there will be |
63 a single source of debugger commands and a single source of Python |
63 a single source of debugger commands and a single source of Python |
64 statements. Commands and statement are always exactly one line and may be |
64 statements. Commands and statement are always exactly one line and may be |
65 interspersed. |
65 interspersed. |
68 debugger and then sends a series of one line commands. A command is either |
68 debugger and then sends a series of one line commands. A command is either |
69 >Load<, >Step<, >StepInto<, ... or a Python statement. |
69 >Load<, >Step<, >StepInto<, ... or a Python statement. |
70 See DebugProtocol.py for a listing of valid protocol tokens. |
70 See DebugProtocol.py for a listing of valid protocol tokens. |
71 </p><p> |
71 </p><p> |
72 A Python statement consists of the statement to execute, followed (in a |
72 A Python statement consists of the statement to execute, followed (in a |
73 separate line) by >OK?<. If the statement was incomplete then the response |
73 separate line) by >OK?<. If the statement was incomplete then the |
74 is >Continue<. If there was an exception then the response is |
74 response is >Continue<. If there was an exception then the response |
75 >Exception<. |
75 is >Exception<. Otherwise the response is >OK<. The reason |
76 Otherwise the response is >OK<. The reason for the >OK?< part is to |
76 for the >OK?< part is to provide a sentinal (ie. the responding |
77 provide a sentinal (ie. the responding >OK<) after any possible output as a |
77 >OK<) after any possible output as a result of executing the command. |
78 result of executing the command. |
|
79 </p><p> |
78 </p><p> |
80 The client may send any other lines at any other time which should be |
79 The client may send any other lines at any other time which should be |
81 interpreted as program output. |
80 interpreted as program output. |
82 </p><p> |
81 </p><p> |
83 If the debugger closes the session there is no response from the client. |
82 If the debugger closes the session there is no response from the client. |
84 The client may close the session at any time as a result of the script |
83 The client may close the session at any time as a result of the script |
85 being debugged closing or crashing. |
84 being debugged closing or crashing. |
86 </p><p> |
85 </p><p> |
87 <b>Note</b>: This class is meant to be subclassed by individual DebugClient classes. |
86 <b>Note</b>: This class is meant to be subclassed by individual |
88 Do not instantiate it directly. |
87 DebugClient classes. Do not instantiate it directly. |
89 </p> |
88 </p> |
90 <h3>Derived from</h3> |
89 <h3>Derived from</h3> |
91 object |
90 object |
92 <h3>Class Attributes</h3> |
91 <h3>Class Attributes</h3> |
93 <table> |
92 <table> |
264 <p> |
263 <p> |
265 Private method to return the variables of a frame to the debug server. |
264 Private method to return the variables of a frame to the debug server. |
266 </p><dl> |
265 </p><dl> |
267 <dt><i>var</i></dt> |
266 <dt><i>var</i></dt> |
268 <dd> |
267 <dd> |
269 list encoded name of the requested variable (list of strings) |
268 list encoded name of the requested variable |
|
269 (list of strings) |
270 </dd><dt><i>frmnr</i></dt> |
270 </dd><dt><i>frmnr</i></dt> |
271 <dd> |
271 <dd> |
272 distance of frame reported on. 0 is the current frame (int) |
272 distance of frame reported on. 0 is the current frame |
|
273 (int) |
273 </dd><dt><i>scope</i></dt> |
274 </dd><dt><i>scope</i></dt> |
274 <dd> |
275 <dd> |
275 1 to report global variables, 0 for local variables (int) |
276 1 to report global variables, 0 for local variables (int) |
276 </dd><dt><i>filter</i></dt> |
277 </dd><dt><i>filter</i></dt> |
277 <dd> |
278 <dd> |
278 the indices of variable types to be filtered (list of int) |
279 the indices of variable types to be filtered |
|
280 (list of int) |
279 </dd> |
281 </dd> |
280 </dl><a NAME="DebugClientBase.__dumpVariables" ID="DebugClientBase.__dumpVariables"></a> |
282 </dl><a NAME="DebugClientBase.__dumpVariables" ID="DebugClientBase.__dumpVariables"></a> |
281 <h4>DebugClientBase.__dumpVariables</h4> |
283 <h4>DebugClientBase.__dumpVariables</h4> |
282 <b>__dumpVariables</b>(<i>frmnr, scope, filter</i>) |
284 <b>__dumpVariables</b>(<i>frmnr, scope, filter</i>) |
283 <p> |
285 <p> |
284 Private method to return the variables of a frame to the debug server. |
286 Private method to return the variables of a frame to the debug server. |
285 </p><dl> |
287 </p><dl> |
286 <dt><i>frmnr</i></dt> |
288 <dt><i>frmnr</i></dt> |
287 <dd> |
289 <dd> |
288 distance of frame reported on. 0 is the current frame (int) |
290 distance of frame reported on. 0 is the current frame |
|
291 (int) |
289 </dd><dt><i>scope</i></dt> |
292 </dd><dt><i>scope</i></dt> |
290 <dd> |
293 <dd> |
291 1 to report global variables, 0 for local variables (int) |
294 1 to report global variables, 0 for local variables (int) |
292 </dd><dt><i>filter</i></dt> |
295 </dd><dt><i>filter</i></dt> |
293 <dd> |
296 <dd> |
294 the indices of variable types to be filtered (list of int) |
297 the indices of variable types to be filtered |
|
298 (list of int) |
295 </dd> |
299 </dd> |
296 </dl><a NAME="DebugClientBase.__exceptionRaised" ID="DebugClientBase.__exceptionRaised"></a> |
300 </dl><a NAME="DebugClientBase.__exceptionRaised" ID="DebugClientBase.__exceptionRaised"></a> |
297 <h4>DebugClientBase.__exceptionRaised</h4> |
301 <h4>DebugClientBase.__exceptionRaised</h4> |
298 <b>__exceptionRaised</b>(<i></i>) |
302 <b>__exceptionRaised</b>(<i></i>) |
299 <p> |
303 <p> |
326 <p> |
330 <p> |
327 Private method to produce a formated variables list. |
331 Private method to produce a formated variables list. |
328 </p><p> |
332 </p><p> |
329 The dictionary passed in to it is scanned. Variables are |
333 The dictionary passed in to it is scanned. Variables are |
330 only added to the list, if their type is not contained |
334 only added to the list, if their type is not contained |
331 in the filter list and their name doesn't match any of the filter expressions. |
335 in the filter list and their name doesn't match any of the filter |
332 The formated variables list (a list of tuples of 3 values) is returned. |
336 expressions. The formated variables list (a list of tuples of 3 |
|
337 values) is returned. |
333 </p><dl> |
338 </p><dl> |
334 <dt><i>keylist</i></dt> |
339 <dt><i>keylist</i></dt> |
335 <dd> |
340 <dd> |
336 keys of the dictionary |
341 keys of the dictionary |
337 </dd><dt><i>dict</i></dt> |
342 </dd><dt><i>dict</i></dt> |
339 the dictionary to be scanned |
344 the dictionary to be scanned |
340 </dd><dt><i>scope</i></dt> |
345 </dd><dt><i>scope</i></dt> |
341 <dd> |
346 <dd> |
342 1 to filter using the globals filter, 0 using the locals |
347 1 to filter using the globals filter, 0 using the locals |
343 filter (int). |
348 filter (int). |
344 Variables are only added to the list, if their name do not match any of the |
349 Variables are only added to the list, if their name do not match |
345 filter expressions. |
350 any of the filter expressions. |
346 </dd><dt><i>filter</i></dt> |
351 </dd><dt><i>filter</i></dt> |
347 <dd> |
352 <dd> |
348 the indices of variable types to be filtered. Variables are |
353 the indices of variable types to be filtered. Variables |
349 only added to the list, if their type is not contained in the filter |
354 are only added to the list, if their type is not contained in the |
350 list. |
355 filter list. |
351 </dd><dt><i>formatSequences</i></dt> |
356 </dd><dt><i>formatSequences</i></dt> |
352 <dd> |
357 <dd> |
353 flag indicating, that sequence or dictionary variables |
358 flag indicating, that sequence or dictionary |
354 should be formatted. If it is 0 (or false), just the number of items contained |
359 variables should be formatted. If it is 0 (or false), just the |
355 in these variables is returned. (boolean) |
360 number of items contained in these variables is returned. (boolean) |
356 </dd> |
361 </dd> |
357 </dl><dl> |
362 </dl><dl> |
358 <dt>Returns:</dt> |
363 <dt>Returns:</dt> |
359 <dd> |
364 <dd> |
360 A tuple consisting of a list of formatted variables. Each variable |
365 A tuple consisting of a list of formatted variables. Each |
361 entry is a tuple of three elements, the variable name, its type and |
366 variable entry is a tuple of three elements, the variable name, |
362 value. |
367 its type and value. |
363 </dd> |
368 </dd> |
364 </dl><a NAME="DebugClientBase.__generateFilterObjects" ID="DebugClientBase.__generateFilterObjects"></a> |
369 </dl><a NAME="DebugClientBase.__generateFilterObjects" ID="DebugClientBase.__generateFilterObjects"></a> |
365 <h4>DebugClientBase.__generateFilterObjects</h4> |
370 <h4>DebugClientBase.__generateFilterObjects</h4> |
366 <b>__generateFilterObjects</b>(<i>scope, filterString</i>) |
371 <b>__generateFilterObjects</b>(<i>scope, filterString</i>) |
367 <p> |
372 <p> |
464 If mainThread is non-zero, then we are attaching to the already |
469 If mainThread is non-zero, then we are attaching to the already |
465 started mainthread of the app and the rest of the args are ignored. |
470 started mainthread of the app and the rest of the args are ignored. |
466 </p><dl> |
471 </p><dl> |
467 <dt><i>target</i></dt> |
472 <dt><i>target</i></dt> |
468 <dd> |
473 <dd> |
469 the start function of the target thread (i.e. the user code) |
474 the start function of the target thread (i.e. the |
|
475 user code) |
470 </dd><dt><i>args</i></dt> |
476 </dd><dt><i>args</i></dt> |
471 <dd> |
477 <dd> |
472 arguments to pass to target |
478 arguments to pass to target |
473 </dd><dt><i>kwargs</i></dt> |
479 </dd><dt><i>kwargs</i></dt> |
474 <dd> |
480 <dd> |
480 </dd> |
486 </dd> |
481 </dl><a NAME="DebugClientBase.close" ID="DebugClientBase.close"></a> |
487 </dl><a NAME="DebugClientBase.close" ID="DebugClientBase.close"></a> |
482 <h4>DebugClientBase.close</h4> |
488 <h4>DebugClientBase.close</h4> |
483 <b>close</b>(<i>fd</i>) |
489 <b>close</b>(<i>fd</i>) |
484 <p> |
490 <p> |
485 Private method implementing a close method as a replacement for os.close(). |
491 Private method implementing a close method as a replacement for |
|
492 os.close(). |
486 </p><p> |
493 </p><p> |
487 It prevents the debugger connections from being closed. |
494 It prevents the debugger connections from being closed. |
488 </p><dl> |
495 </p><dl> |
489 <dt><i>fd</i></dt> |
496 <dt><i>fd</i></dt> |
490 <dd> |
497 <dd> |
503 <dt><i>port</i></dt> |
510 <dt><i>port</i></dt> |
504 <dd> |
511 <dd> |
505 the port number to connect to (int) |
512 the port number to connect to (int) |
506 </dd><dt><i>remoteAddress</i></dt> |
513 </dd><dt><i>remoteAddress</i></dt> |
507 <dd> |
514 <dd> |
508 the network address of the debug server host (string) |
515 the network address of the debug server host |
|
516 (string) |
509 </dd><dt><i>redirect</i></dt> |
517 </dd><dt><i>redirect</i></dt> |
510 <dd> |
518 <dd> |
511 flag indicating redirection of stdin, stdout and stderr (boolean) |
519 flag indicating redirection of stdin, stdout and |
|
520 stderr (boolean) |
512 </dd> |
521 </dd> |
513 </dl><a NAME="DebugClientBase.eventLoop" ID="DebugClientBase.eventLoop"></a> |
522 </dl><a NAME="DebugClientBase.eventLoop" ID="DebugClientBase.eventLoop"></a> |
514 <h4>DebugClientBase.eventLoop</h4> |
523 <h4>DebugClientBase.eventLoop</h4> |
515 <b>eventLoop</b>(<i>disablePolling=False</i>) |
524 <b>eventLoop</b>(<i>disablePolling=False</i>) |
516 <p> |
525 <p> |
561 <h4>DebugClientBase.handleLine</h4> |
570 <h4>DebugClientBase.handleLine</h4> |
562 <b>handleLine</b>(<i>line</i>) |
571 <b>handleLine</b>(<i>line</i>) |
563 <p> |
572 <p> |
564 Public method to handle the receipt of a complete line. |
573 Public method to handle the receipt of a complete line. |
565 </p><p> |
574 </p><p> |
566 It first looks for a valid protocol token at the start of the line. Thereafter |
575 It first looks for a valid protocol token at the start of the line. |
567 it trys to execute the lines accumulated so far. |
576 Thereafter it trys to execute the lines accumulated so far. |
568 </p><dl> |
577 </p><dl> |
569 <dt><i>line</i></dt> |
578 <dt><i>line</i></dt> |
570 <dd> |
579 <dd> |
571 the received line |
580 the received line |
572 </dd> |
581 </dd> |
626 </dd> |
635 </dd> |
627 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a> |
636 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a> |
628 <h4>DebugClientBase.sessionClose</h4> |
637 <h4>DebugClientBase.sessionClose</h4> |
629 <b>sessionClose</b>(<i>exit=True</i>) |
638 <b>sessionClose</b>(<i>exit=True</i>) |
630 <p> |
639 <p> |
631 Public method to close the session with the debugger and optionally terminate. |
640 Public method to close the session with the debugger and optionally |
|
641 terminate. |
632 </p><dl> |
642 </p><dl> |
633 <dt><i>exit</i></dt> |
643 <dt><i>exit</i></dt> |
634 <dd> |
644 <dd> |
635 flag indicating to terminate (boolean) |
645 flag indicating to terminate (boolean) |
636 </dd> |
646 </dd> |
645 filename to be checked |
655 filename to be checked |
646 </dd> |
656 </dd> |
647 </dl><dl> |
657 </dl><dl> |
648 <dt>Returns:</dt> |
658 <dt>Returns:</dt> |
649 <dd> |
659 <dd> |
650 non-zero if fn represents a file we are 'skipping', zero otherwise. |
660 non-zero if fn represents a file we are 'skipping', |
|
661 zero otherwise. |
651 </dd> |
662 </dd> |
652 </dl><a NAME="DebugClientBase.startDebugger" ID="DebugClientBase.startDebugger"></a> |
663 </dl><a NAME="DebugClientBase.startDebugger" ID="DebugClientBase.startDebugger"></a> |
653 <h4>DebugClientBase.startDebugger</h4> |
664 <h4>DebugClientBase.startDebugger</h4> |
654 <b>startDebugger</b>(<i>filename=None, host=None, port=None, enableTrace=True, exceptions=True, tracePython=False, redirect=True</i>) |
665 <b>startDebugger</b>(<i>filename=None, host=None, port=None, enableTrace=True, exceptions=True, tracePython=False, redirect=True</i>) |
655 <p> |
666 <p> |
667 </dd><dt><i>enableTrace</i></dt> |
678 </dd><dt><i>enableTrace</i></dt> |
668 <dd> |
679 <dd> |
669 flag to enable the tracing function (boolean) |
680 flag to enable the tracing function (boolean) |
670 </dd><dt><i>exceptions</i></dt> |
681 </dd><dt><i>exceptions</i></dt> |
671 <dd> |
682 <dd> |
672 flag to enable exception reporting of the IDE (boolean) |
683 flag to enable exception reporting of the IDE |
|
684 (boolean) |
673 </dd><dt><i>tracePython</i></dt> |
685 </dd><dt><i>tracePython</i></dt> |
674 <dd> |
686 <dd> |
675 flag to enable tracing into the Python library (boolean) |
687 flag to enable tracing into the Python library |
|
688 (boolean) |
676 </dd><dt><i>redirect</i></dt> |
689 </dd><dt><i>redirect</i></dt> |
677 <dd> |
690 <dd> |
678 flag indicating redirection of stdin, stdout and stderr (boolean) |
691 flag indicating redirection of stdin, stdout and |
|
692 stderr (boolean) |
679 </dd> |
693 </dd> |
680 </dl><a NAME="DebugClientBase.startProgInDebugger" ID="DebugClientBase.startProgInDebugger"></a> |
694 </dl><a NAME="DebugClientBase.startProgInDebugger" ID="DebugClientBase.startProgInDebugger"></a> |
681 <h4>DebugClientBase.startProgInDebugger</h4> |
695 <h4>DebugClientBase.startProgInDebugger</h4> |
682 <b>startProgInDebugger</b>(<i>progargs, wd='', host=None, port=None, exceptions=True, tracePython=False, redirect=True</i>) |
696 <b>startProgInDebugger</b>(<i>progargs, wd='', host=None, port=None, exceptions=True, tracePython=False, redirect=True</i>) |
683 <p> |
697 <p> |
696 </dd><dt><i>port</i></dt> |
710 </dd><dt><i>port</i></dt> |
697 <dd> |
711 <dd> |
698 portnumber of the debug server (int) |
712 portnumber of the debug server (int) |
699 </dd><dt><i>exceptions</i></dt> |
713 </dd><dt><i>exceptions</i></dt> |
700 <dd> |
714 <dd> |
701 flag to enable exception reporting of the IDE (boolean) |
715 flag to enable exception reporting of the IDE |
|
716 (boolean) |
702 </dd><dt><i>tracePython</i></dt> |
717 </dd><dt><i>tracePython</i></dt> |
703 <dd> |
718 <dd> |
704 flag to enable tracing into the Python library (boolean) |
719 flag to enable tracing into the Python library |
|
720 (boolean) |
705 </dd><dt><i>redirect</i></dt> |
721 </dd><dt><i>redirect</i></dt> |
706 <dd> |
722 <dd> |
707 flag indicating redirection of stdin, stdout and stderr (boolean) |
723 flag indicating redirection of stdin, stdout and |
|
724 stderr (boolean) |
708 </dd> |
725 </dd> |
709 </dl><a NAME="DebugClientBase.write" ID="DebugClientBase.write"></a> |
726 </dl><a NAME="DebugClientBase.write" ID="DebugClientBase.write"></a> |
710 <h4>DebugClientBase.write</h4> |
727 <h4>DebugClientBase.write</h4> |
711 <b>write</b>(<i>s</i>) |
728 <b>write</b>(<i>s</i>) |
712 <p> |
729 <p> |