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

changeset 3018
70924c0bdaf1
parent 2966
f85f686981ad
child 3591
2f2a4a76dd22
equal deleted inserted replaced
3017:6a8cb7632448 3018:70924c0bdaf1
57 <a NAME="DebugClientBase" ID="DebugClientBase"></a> 57 <a NAME="DebugClientBase" ID="DebugClientBase"></a>
58 <h2>DebugClientBase</h2> 58 <h2>DebugClientBase</h2>
59 <p> 59 <p>
60 Class implementing the client side of the debugger. 60 Class implementing the client side of the debugger.
61 </p><p> 61 </p><p>
62 It provides access to the Python interpeter from a debugger running in another 62 It provides access to the Python interpeter from a debugger running in
63 process whether or not the Qt event loop is running. 63 another process whether or not the Qt event loop is running.
64 </p><p> 64 </p><p>
65 The protocol between the debugger and the client assumes that there will be 65 The protocol between the debugger and the client assumes that there will be
66 a single source of debugger commands and a single source of Python 66 a single source of debugger commands and a single source of Python
67 statements. Commands and statement are always exactly one line and may be 67 statements. Commands and statement are always exactly one line and may be
68 interspersed. 68 interspersed.
71 debugger and then sends a series of one line commands. A command is either 71 debugger and then sends a series of one line commands. A command is either
72 &gt;Load&lt;, &gt;Step&lt;, &gt;StepInto&lt;, ... or a Python statement. 72 &gt;Load&lt;, &gt;Step&lt;, &gt;StepInto&lt;, ... or a Python statement.
73 See DebugProtocol.py for a listing of valid protocol tokens. 73 See DebugProtocol.py for a listing of valid protocol tokens.
74 </p><p> 74 </p><p>
75 A Python statement consists of the statement to execute, followed (in a 75 A Python statement consists of the statement to execute, followed (in a
76 separate line) by &gt;OK?&lt;. If the statement was incomplete then the response 76 separate line) by &gt;OK?&lt;. If the statement was incomplete then the
77 is &gt;Continue&lt;. If there was an exception then the response is 77 response is &gt;Continue&lt;. If there was an exception then the response
78 &gt;Exception&lt;. 78 is &gt;Exception&lt;. Otherwise the response is &gt;OK&lt;. The reason
79 Otherwise the response is &gt;OK&lt;. The reason for the &gt;OK?&lt; part is to 79 for the &gt;OK?&lt; part is to provide a sentinal (ie. the responding
80 provide a sentinal (ie. the responding &gt;OK&lt;) after any possible output as a 80 &gt;OK&lt;) after any possible output as a result of executing the command.
81 result of executing the command.
82 </p><p> 81 </p><p>
83 The client may send any other lines at any other time which should be 82 The client may send any other lines at any other time which should be
84 interpreted as program output. 83 interpreted as program output.
85 </p><p> 84 </p><p>
86 If the debugger closes the session there is no response from the client. 85 If the debugger closes the session there is no response from the client.
87 The client may close the session at any time as a result of the script 86 The client may close the session at any time as a result of the script
88 being debugged closing or crashing. 87 being debugged closing or crashing.
89 </p><p> 88 </p><p>
90 <b>Note</b>: This class is meant to be subclassed by individual DebugClient classes. 89 <b>Note</b>: This class is meant to be subclassed by individual
91 Do not instantiate it directly. 90 DebugClient classes. Do not instantiate it directly.
92 </p> 91 </p>
93 <h3>Derived from</h3> 92 <h3>Derived from</h3>
94 object 93 object
95 <h3>Class Attributes</h3> 94 <h3>Class Attributes</h3>
96 <table> 95 <table>
249 <p> 248 <p>
250 Private method to return the variables of a frame to the debug server. 249 Private method to return the variables of a frame to the debug server.
251 </p><dl> 250 </p><dl>
252 <dt><i>var</i></dt> 251 <dt><i>var</i></dt>
253 <dd> 252 <dd>
254 list encoded name of the requested variable (list of strings) 253 list encoded name of the requested variable
254 (list of strings)
255 </dd><dt><i>frmnr</i></dt> 255 </dd><dt><i>frmnr</i></dt>
256 <dd> 256 <dd>
257 distance of frame reported on. 0 is the current frame (int) 257 distance of frame reported on. 0 is the current frame
258 (int)
258 </dd><dt><i>scope</i></dt> 259 </dd><dt><i>scope</i></dt>
259 <dd> 260 <dd>
260 1 to report global variables, 0 for local variables (int) 261 1 to report global variables, 0 for local variables (int)
261 </dd><dt><i>filter</i></dt> 262 </dd><dt><i>filter</i></dt>
262 <dd> 263 <dd>
263 the indices of variable types to be filtered (list of int) 264 the indices of variable types to be filtered
265 (list of int)
264 </dd> 266 </dd>
265 </dl><a NAME="DebugClientBase.__dumpVariables" ID="DebugClientBase.__dumpVariables"></a> 267 </dl><a NAME="DebugClientBase.__dumpVariables" ID="DebugClientBase.__dumpVariables"></a>
266 <h4>DebugClientBase.__dumpVariables</h4> 268 <h4>DebugClientBase.__dumpVariables</h4>
267 <b>__dumpVariables</b>(<i>frmnr, scope, filter</i>) 269 <b>__dumpVariables</b>(<i>frmnr, scope, filter</i>)
268 <p> 270 <p>
269 Private method to return the variables of a frame to the debug server. 271 Private method to return the variables of a frame to the debug server.
270 </p><dl> 272 </p><dl>
271 <dt><i>frmnr</i></dt> 273 <dt><i>frmnr</i></dt>
272 <dd> 274 <dd>
273 distance of frame reported on. 0 is the current frame (int) 275 distance of frame reported on. 0 is the current frame
276 (int)
274 </dd><dt><i>scope</i></dt> 277 </dd><dt><i>scope</i></dt>
275 <dd> 278 <dd>
276 1 to report global variables, 0 for local variables (int) 279 1 to report global variables, 0 for local variables (int)
277 </dd><dt><i>filter</i></dt> 280 </dd><dt><i>filter</i></dt>
278 <dd> 281 <dd>
279 the indices of variable types to be filtered (list of int) 282 the indices of variable types to be filtered (list of
283 int)
280 </dd> 284 </dd>
281 </dl><a NAME="DebugClientBase.__exceptionRaised" ID="DebugClientBase.__exceptionRaised"></a> 285 </dl><a NAME="DebugClientBase.__exceptionRaised" ID="DebugClientBase.__exceptionRaised"></a>
282 <h4>DebugClientBase.__exceptionRaised</h4> 286 <h4>DebugClientBase.__exceptionRaised</h4>
283 <b>__exceptionRaised</b>(<i></i>) 287 <b>__exceptionRaised</b>(<i></i>)
284 <p> 288 <p>
311 <p> 315 <p>
312 Private method to produce a formated variables list. 316 Private method to produce a formated variables list.
313 </p><p> 317 </p><p>
314 The dictionary passed in to it is scanned. Variables are 318 The dictionary passed in to it is scanned. Variables are
315 only added to the list, if their type is not contained 319 only added to the list, if their type is not contained
316 in the filter list and their name doesn't match any of the filter expressions. 320 in the filter list and their name doesn't match any of
317 The formated variables list (a list of tuples of 3 values) is returned. 321 the filter expressions. The formated variables list (a list of tuples
322 of 3 values) is returned.
318 </p><dl> 323 </p><dl>
319 <dt><i>keylist</i></dt> 324 <dt><i>keylist</i></dt>
320 <dd> 325 <dd>
321 keys of the dictionary 326 keys of the dictionary
322 </dd><dt><i>dict</i></dt> 327 </dd><dt><i>dict</i></dt>
324 the dictionary to be scanned 329 the dictionary to be scanned
325 </dd><dt><i>scope</i></dt> 330 </dd><dt><i>scope</i></dt>
326 <dd> 331 <dd>
327 1 to filter using the globals filter, 0 using the locals 332 1 to filter using the globals filter, 0 using the locals
328 filter (int). 333 filter (int).
329 Variables are only added to the list, if their name do not match any of the 334 Variables are only added to the list, if their name do not match
330 filter expressions. 335 any of the filter expressions.
331 </dd><dt><i>filter</i></dt> 336 </dd><dt><i>filter</i></dt>
332 <dd> 337 <dd>
333 the indices of variable types to be filtered. Variables are 338 the indices of variable types to be filtered. Variables
334 only added to the list, if their type is not contained in the filter 339 are only added to the list, if their type is not contained in the
335 list. 340 filter list.
336 </dd><dt><i>formatSequences</i></dt> 341 </dd><dt><i>formatSequences</i></dt>
337 <dd> 342 <dd>
338 flag indicating, that sequence or dictionary variables 343 flag indicating, that sequence or dictionary
339 should be formatted. If it is 0 (or false), just the number of items contained 344 variables should be formatted. If it is 0 (or false), just the
340 in these variables is returned. (boolean) 345 number of items contained in these variables is returned. (boolean)
341 </dd> 346 </dd>
342 </dl><dl> 347 </dl><dl>
343 <dt>Returns:</dt> 348 <dt>Returns:</dt>
344 <dd> 349 <dd>
345 A tuple consisting of a list of formatted variables. Each variable 350 A tuple consisting of a list of formatted variables. Each
346 entry is a tuple of three elements, the variable name, its type and 351 variable entry is a tuple of three elements, the variable name,
347 value. 352 its type and value.
348 </dd> 353 </dd>
349 </dl><a NAME="DebugClientBase.__generateFilterObjects" ID="DebugClientBase.__generateFilterObjects"></a> 354 </dl><a NAME="DebugClientBase.__generateFilterObjects" ID="DebugClientBase.__generateFilterObjects"></a>
350 <h4>DebugClientBase.__generateFilterObjects</h4> 355 <h4>DebugClientBase.__generateFilterObjects</h4>
351 <b>__generateFilterObjects</b>(<i>scope, filterString</i>) 356 <b>__generateFilterObjects</b>(<i>scope, filterString</i>)
352 <p> 357 <p>
452 This is just an empty function and is overridden in the threaded 457 This is just an empty function and is overridden in the threaded
453 debugger. 458 debugger.
454 </p><dl> 459 </p><dl>
455 <dt><i>target</i></dt> 460 <dt><i>target</i></dt>
456 <dd> 461 <dd>
457 the start function of the target thread (i.e. the user code) 462 the start function of the target thread (i.e. the user
463 code)
458 </dd><dt><i>args</i></dt> 464 </dd><dt><i>args</i></dt>
459 <dd> 465 <dd>
460 arguments to pass to target 466 arguments to pass to target
461 </dd><dt><i>kwargs</i></dt> 467 </dd><dt><i>kwargs</i></dt>
462 <dd> 468 <dd>
468 </dd> 474 </dd>
469 </dl><a NAME="DebugClientBase.close" ID="DebugClientBase.close"></a> 475 </dl><a NAME="DebugClientBase.close" ID="DebugClientBase.close"></a>
470 <h4>DebugClientBase.close</h4> 476 <h4>DebugClientBase.close</h4>
471 <b>close</b>(<i>fd</i>) 477 <b>close</b>(<i>fd</i>)
472 <p> 478 <p>
473 Private method implementing a close method as a replacement for os.close(). 479 Private method implementing a close method as a replacement for
480 os.close().
474 </p><p> 481 </p><p>
475 It prevents the debugger connections from being closed. 482 It prevents the debugger connections from being closed.
476 </p><dl> 483 </p><dl>
477 <dt><i>fd</i></dt> 484 <dt><i>fd</i></dt>
478 <dd> 485 <dd>
491 <dt><i>port</i></dt> 498 <dt><i>port</i></dt>
492 <dd> 499 <dd>
493 the port number to connect to (int) 500 the port number to connect to (int)
494 </dd><dt><i>remoteAddress</i></dt> 501 </dd><dt><i>remoteAddress</i></dt>
495 <dd> 502 <dd>
496 the network address of the debug server host (string) 503 the network address of the debug server host
504 (string)
497 </dd><dt><i>redirect</i></dt> 505 </dd><dt><i>redirect</i></dt>
498 <dd> 506 <dd>
499 flag indicating redirection of stdin, stdout and stderr (boolean) 507 flag indicating redirection of stdin, stdout and
508 stderr (boolean)
500 </dd> 509 </dd>
501 </dl><a NAME="DebugClientBase.eventLoop" ID="DebugClientBase.eventLoop"></a> 510 </dl><a NAME="DebugClientBase.eventLoop" ID="DebugClientBase.eventLoop"></a>
502 <h4>DebugClientBase.eventLoop</h4> 511 <h4>DebugClientBase.eventLoop</h4>
503 <b>eventLoop</b>(<i>disablePolling=False</i>) 512 <b>eventLoop</b>(<i>disablePolling=False</i>)
504 <p> 513 <p>
549 <h4>DebugClientBase.handleLine</h4> 558 <h4>DebugClientBase.handleLine</h4>
550 <b>handleLine</b>(<i>line</i>) 559 <b>handleLine</b>(<i>line</i>)
551 <p> 560 <p>
552 Public method to handle the receipt of a complete line. 561 Public method to handle the receipt of a complete line.
553 </p><p> 562 </p><p>
554 It first looks for a valid protocol token at the start of the line. Thereafter 563 It first looks for a valid protocol token at the start of the line.
555 it trys to execute the lines accumulated so far. 564 Thereafter it trys to execute the lines accumulated so far.
556 </p><dl> 565 </p><dl>
557 <dt><i>line</i></dt> 566 <dt><i>line</i></dt>
558 <dd> 567 <dd>
559 the received line 568 the received line
560 </dd> 569 </dd>
629 </dd> 638 </dd>
630 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a> 639 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a>
631 <h4>DebugClientBase.sessionClose</h4> 640 <h4>DebugClientBase.sessionClose</h4>
632 <b>sessionClose</b>(<i>exit=1</i>) 641 <b>sessionClose</b>(<i>exit=1</i>)
633 <p> 642 <p>
634 Public method to close the session with the debugger and optionally terminate. 643 Public method to close the session with the debugger and optionally
644 terminate.
635 </p><dl> 645 </p><dl>
636 <dt><i>exit</i></dt> 646 <dt><i>exit</i></dt>
637 <dd> 647 <dd>
638 flag indicating to terminate (boolean) 648 flag indicating to terminate (boolean)
639 </dd> 649 </dd>
648 filename to be checked 658 filename to be checked
649 </dd> 659 </dd>
650 </dl><dl> 660 </dl><dl>
651 <dt>Returns:</dt> 661 <dt>Returns:</dt>
652 <dd> 662 <dd>
653 non-zero if fn represents a file we are 'skipping', zero otherwise. 663 non-zero if fn represents a file we are 'skipping',
664 zero otherwise.
654 </dd> 665 </dd>
655 </dl><a NAME="DebugClientBase.startDebugger" ID="DebugClientBase.startDebugger"></a> 666 </dl><a NAME="DebugClientBase.startDebugger" ID="DebugClientBase.startDebugger"></a>
656 <h4>DebugClientBase.startDebugger</h4> 667 <h4>DebugClientBase.startDebugger</h4>
657 <b>startDebugger</b>(<i>filename=None, host=None, port=None, enableTrace=1, exceptions=1, tracePython=0, redirect=1</i>) 668 <b>startDebugger</b>(<i>filename=None, host=None, port=None, enableTrace=1, exceptions=1, tracePython=0, redirect=1</i>)
658 <p> 669 <p>
670 </dd><dt><i>enableTrace</i></dt> 681 </dd><dt><i>enableTrace</i></dt>
671 <dd> 682 <dd>
672 flag to enable the tracing function (boolean) 683 flag to enable the tracing function (boolean)
673 </dd><dt><i>exceptions</i></dt> 684 </dd><dt><i>exceptions</i></dt>
674 <dd> 685 <dd>
675 flag to enable exception reporting of the IDE (boolean) 686 flag to enable exception reporting of the IDE
687 (boolean)
676 </dd><dt><i>tracePython</i></dt> 688 </dd><dt><i>tracePython</i></dt>
677 <dd> 689 <dd>
678 flag to enable tracing into the Python library (boolean) 690 flag to enable tracing into the Python library
691 (boolean)
679 </dd><dt><i>redirect</i></dt> 692 </dd><dt><i>redirect</i></dt>
680 <dd> 693 <dd>
681 flag indicating redirection of stdin, stdout and stderr (boolean) 694 flag indicating redirection of stdin, stdout and
695 stderr (boolean)
682 </dd> 696 </dd>
683 </dl><a NAME="DebugClientBase.startProgInDebugger" ID="DebugClientBase.startProgInDebugger"></a> 697 </dl><a NAME="DebugClientBase.startProgInDebugger" ID="DebugClientBase.startProgInDebugger"></a>
684 <h4>DebugClientBase.startProgInDebugger</h4> 698 <h4>DebugClientBase.startProgInDebugger</h4>
685 <b>startProgInDebugger</b>(<i>progargs, wd='', host=None, port=None, exceptions=1, tracePython=0, redirect=1</i>) 699 <b>startProgInDebugger</b>(<i>progargs, wd='', host=None, port=None, exceptions=1, tracePython=0, redirect=1</i>)
686 <p> 700 <p>
699 </dd><dt><i>port</i></dt> 713 </dd><dt><i>port</i></dt>
700 <dd> 714 <dd>
701 portnumber of the debug server (int) 715 portnumber of the debug server (int)
702 </dd><dt><i>exceptions</i></dt> 716 </dd><dt><i>exceptions</i></dt>
703 <dd> 717 <dd>
704 flag to enable exception reporting of the IDE (boolean) 718 flag to enable exception reporting of the IDE
719 (boolean)
705 </dd><dt><i>tracePython</i></dt> 720 </dd><dt><i>tracePython</i></dt>
706 <dd> 721 <dd>
707 flag to enable tracing into the Python library (boolean) 722 flag to enable tracing into the Python library
723 (boolean)
708 </dd><dt><i>redirect</i></dt> 724 </dd><dt><i>redirect</i></dt>
709 <dd> 725 <dd>
710 flag indicating redirection of stdin, stdout and stderr (boolean) 726 flag indicating redirection of stdin, stdout and
727 stderr (boolean)
711 </dd> 728 </dd>
712 </dl><a NAME="DebugClientBase.write" ID="DebugClientBase.write"></a> 729 </dl><a NAME="DebugClientBase.write" ID="DebugClientBase.write"></a>
713 <h4>DebugClientBase.write</h4> 730 <h4>DebugClientBase.write</h4>
714 <b>write</b>(<i>s</i>) 731 <b>write</b>(<i>s</i>)
715 <p> 732 <p>

eric ide

mercurial