Documentation/Source/eric6.DebugClients.Python3.DebugClientBase.html

changeset 5144
1ab536d25072
parent 4945
aa494a61240b
child 5161
f7b6ded9cc37
equal deleted inserted replaced
5141:bc64243b7672 5144:1ab536d25072
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 59 It provides access to the Python interpeter from a debugger running in
60 another process whether or not the Qt event loop is running. 60 another process.
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 is based on JSONRPC 2.0
63 a single source of debugger commands and a single source of Python 63 PDUs. Each one is sent on a single line, i.e. commands or responses are
64 statements. Commands and statement are always exactly one line and may be 64 separated by a linefeed character.
65 interspersed.
66 </p><p>
67 The protocol is as follows. First the client opens a connection to the
68 debugger and then sends a series of one line commands. A command is either
69 &gt;Load&lt;, &gt;Step&lt;, &gt;StepInto&lt;, ... or a Python statement.
70 See DebugProtocol.py for a listing of valid protocol tokens.
71 </p><p>
72 A Python statement consists of the statement to execute, followed (in a
73 separate line) by &gt;OK?&lt;. If the statement was incomplete then the
74 response is &gt;Continue&lt;. If there was an exception then the response
75 is &gt;Exception&lt;. Otherwise the response is &gt;OK&lt;. The reason
76 for the &gt;OK?&lt; part is to provide a sentinal (ie. the responding
77 &gt;OK&lt;) after any possible output as a result of executing the command.
78 </p><p>
79 The client may send any other lines at any other time which should be
80 interpreted as program output.
81 </p><p> 65 </p><p>
82 If the debugger closes the session there is no response from the client. 66 If the debugger closes the session there is no response from the client.
83 The client may close the session at any time as a result of the script 67 The client may close the session at any time as a result of the script
84 being debugged closing or crashing. 68 being debugged closing or crashing.
85 </p><p> 69 </p><p>
118 <td>Private method to return the variables of a frame to the debug server.</td> 102 <td>Private method to return the variables of a frame to the debug server.</td>
119 </tr><tr> 103 </tr><tr>
120 <td><a href="#DebugClientBase.__dumpVariables">__dumpVariables</a></td> 104 <td><a href="#DebugClientBase.__dumpVariables">__dumpVariables</a></td>
121 <td>Private method to return the variables of a frame to the debug server.</td> 105 <td>Private method to return the variables of a frame to the debug server.</td>
122 </tr><tr> 106 </tr><tr>
123 <td><a href="#DebugClientBase.__exceptionRaised">__exceptionRaised</a></td>
124 <td>Private method called in the case of an exception.</td>
125 </tr><tr>
126 <td><a href="#DebugClientBase.__formatQtVariable">__formatQtVariable</a></td> 107 <td><a href="#DebugClientBase.__formatQtVariable">__formatQtVariable</a></td>
127 <td>Private method to produce a formatted output of a simple Qt4/Qt5 type.</td> 108 <td>Private method to produce a formatted output of a simple Qt4/Qt5 type.</td>
128 </tr><tr> 109 </tr><tr>
129 <td><a href="#DebugClientBase.__formatVariablesList">__formatVariablesList</a></td> 110 <td><a href="#DebugClientBase.__formatVariablesList">__formatVariablesList</a></td>
130 <td>Private method to produce a formated variables list.</td> 111 <td>Private method to produce a formated variables list.</td>
181 <td>Public method to return the current coding.</td> 162 <td>Public method to return the current coding.</td>
182 </tr><tr> 163 </tr><tr>
183 <td><a href="#DebugClientBase.getRunning">getRunning</a></td> 164 <td><a href="#DebugClientBase.getRunning">getRunning</a></td>
184 <td>Public method to return the main script we are currently running.</td> 165 <td>Public method to return the main script we are currently running.</td>
185 </tr><tr> 166 </tr><tr>
167 <td><a href="#DebugClientBase.handleJsonCommand">handleJsonCommand</a></td>
168 <td>Public method to handle a command serialized as a JSON string.</td>
169 </tr><tr>
186 <td><a href="#DebugClientBase.handleLine">handleLine</a></td> 170 <td><a href="#DebugClientBase.handleLine">handleLine</a></td>
187 <td>Public method to handle the receipt of a complete line.</td> 171 <td>Public method to handle the receipt of a complete line.</td>
188 </tr><tr> 172 </tr><tr>
189 <td><a href="#DebugClientBase.input">input</a></td> 173 <td><a href="#DebugClientBase.input">input</a></td>
190 <td>Public method to implement input() using the event loop.</td> 174 <td>Public method to implement input() using the event loop.</td>
193 <td>Public method implementing the main method.</td> 177 <td>Public method implementing the main method.</td>
194 </tr><tr> 178 </tr><tr>
195 <td><a href="#DebugClientBase.progTerminated">progTerminated</a></td> 179 <td><a href="#DebugClientBase.progTerminated">progTerminated</a></td>
196 <td>Public method to tell the debugger that the program has terminated.</td> 180 <td>Public method to tell the debugger that the program has terminated.</td>
197 </tr><tr> 181 </tr><tr>
182 <td><a href="#DebugClientBase.readReady">readReady</a></td>
183 <td>Public method called when there is data ready to be read.</td>
184 </tr><tr>
198 <td><a href="#DebugClientBase.run_call">run_call</a></td> 185 <td><a href="#DebugClientBase.run_call">run_call</a></td>
199 <td>Public method used to start the remote debugger and call a function.</td> 186 <td>Public method used to start the remote debugger and call a function.</td>
200 </tr><tr> 187 </tr><tr>
188 <td><a href="#DebugClientBase.sendCallTrace">sendCallTrace</a></td>
189 <td>Public method to send a call trace entry.</td>
190 </tr><tr>
191 <td><a href="#DebugClientBase.sendClearTemporaryBreakpoint">sendClearTemporaryBreakpoint</a></td>
192 <td>Public method to signal the deletion of a temporary breakpoint.</td>
193 </tr><tr>
194 <td><a href="#DebugClientBase.sendClearTemporaryWatch">sendClearTemporaryWatch</a></td>
195 <td>Public method to signal the deletion of a temporary watch expression.</td>
196 </tr><tr>
197 <td><a href="#DebugClientBase.sendException">sendException</a></td>
198 <td>Public method to send information for an exception.</td>
199 </tr><tr>
200 <td><a href="#DebugClientBase.sendJsonCommand">sendJsonCommand</a></td>
201 <td>Public method to send a single command or response to the IDE.</td>
202 </tr><tr>
203 <td><a href="#DebugClientBase.sendPassiveStartup">sendPassiveStartup</a></td>
204 <td>Public method to send the passive start information.</td>
205 </tr><tr>
206 <td><a href="#DebugClientBase.sendResponseLine">sendResponseLine</a></td>
207 <td>Public method to send the current call stack.</td>
208 </tr><tr>
209 <td><a href="#DebugClientBase.sendSyntaxError">sendSyntaxError</a></td>
210 <td>Public method to send information for a syntax error.</td>
211 </tr><tr>
201 <td><a href="#DebugClientBase.sessionClose">sessionClose</a></td> 212 <td><a href="#DebugClientBase.sessionClose">sessionClose</a></td>
202 <td>Public method to close the session with the debugger and optionally terminate.</td> 213 <td>Public method to close the session with the debugger and optionally terminate.</td>
203 </tr><tr> 214 </tr><tr>
204 <td><a href="#DebugClientBase.shouldSkip">shouldSkip</a></td> 215 <td><a href="#DebugClientBase.shouldSkip">shouldSkip</a></td>
205 <td>Public method to check if a file should be skipped.</td> 216 <td>Public method to check if a file should be skipped.</td>
208 <td>Public method used to start the remote debugger.</td> 219 <td>Public method used to start the remote debugger.</td>
209 </tr><tr> 220 </tr><tr>
210 <td><a href="#DebugClientBase.startProgInDebugger">startProgInDebugger</a></td> 221 <td><a href="#DebugClientBase.startProgInDebugger">startProgInDebugger</a></td>
211 <td>Public method used to start the remote debugger.</td> 222 <td>Public method used to start the remote debugger.</td>
212 </tr><tr> 223 </tr><tr>
213 <td><a href="#DebugClientBase.write">write</a></td> 224 <td><a href="#DebugClientBase.writeReady">writeReady</a></td>
214 <td>Public method to write data to the output stream.</td> 225 <td>Public method called when we are ready to write data.</td>
215 </tr> 226 </tr>
216 </table> 227 </table>
217 <h3>Static Methods</h3> 228 <h3>Static Methods</h3>
218 <table> 229 <table>
219 <tr><td>None</td></tr> 230 <tr><td>None</td></tr>
304 </dd><dt><i>filter</i></dt> 315 </dd><dt><i>filter</i></dt>
305 <dd> 316 <dd>
306 the indices of variable types to be filtered 317 the indices of variable types to be filtered
307 (list of int) 318 (list of int)
308 </dd> 319 </dd>
309 </dl><a NAME="DebugClientBase.__exceptionRaised" ID="DebugClientBase.__exceptionRaised"></a> 320 </dl><a NAME="DebugClientBase.__formatQtVariable" ID="DebugClientBase.__formatQtVariable"></a>
310 <h4>DebugClientBase.__exceptionRaised</h4>
311 <b>__exceptionRaised</b>(<i></i>)
312 <p>
313 Private method called in the case of an exception.
314 </p><p>
315 It ensures that the debug server is informed of the raised exception.
316 </p><a NAME="DebugClientBase.__formatQtVariable" ID="DebugClientBase.__formatQtVariable"></a>
317 <h4>DebugClientBase.__formatQtVariable</h4> 321 <h4>DebugClientBase.__formatQtVariable</h4>
318 <b>__formatQtVariable</b>(<i>value, vtype</i>) 322 <b>__formatQtVariable</b>(<i>value, vtype</i>)
319 <p> 323 <p>
320 Private method to produce a formatted output of a simple Qt4/Qt5 type. 324 Private method to produce a formatted output of a simple Qt4/Qt5 type.
321 </p><dl> 325 </p><dl>
607 </p><dl> 611 </p><dl>
608 <dt>Returns:</dt> 612 <dt>Returns:</dt>
609 <dd> 613 <dd>
610 flag indicating a running debug session (boolean) 614 flag indicating a running debug session (boolean)
611 </dd> 615 </dd>
616 </dl><a NAME="DebugClientBase.handleJsonCommand" ID="DebugClientBase.handleJsonCommand"></a>
617 <h4>DebugClientBase.handleJsonCommand</h4>
618 <b>handleJsonCommand</b>(<i>jsonStr</i>)
619 <p>
620 Public method to handle a command serialized as a JSON string.
621 </p><dl>
622 <dt><i>jsonStr</i> (str)</dt>
623 <dd>
624 string containing the command received from the IDE
625 </dd>
612 </dl><a NAME="DebugClientBase.handleLine" ID="DebugClientBase.handleLine"></a> 626 </dl><a NAME="DebugClientBase.handleLine" ID="DebugClientBase.handleLine"></a>
613 <h4>DebugClientBase.handleLine</h4> 627 <h4>DebugClientBase.handleLine</h4>
614 <b>handleLine</b>(<i>line</i>) 628 <b>handleLine</b>(<i>line</i>)
615 <p> 629 <p>
616 Public method to handle the receipt of a complete line. 630 Public method to handle the receipt of a complete line.
645 <b>main</b>(<i></i>) 659 <b>main</b>(<i></i>)
646 <p> 660 <p>
647 Public method implementing the main method. 661 Public method implementing the main method.
648 </p><a NAME="DebugClientBase.progTerminated" ID="DebugClientBase.progTerminated"></a> 662 </p><a NAME="DebugClientBase.progTerminated" ID="DebugClientBase.progTerminated"></a>
649 <h4>DebugClientBase.progTerminated</h4> 663 <h4>DebugClientBase.progTerminated</h4>
650 <b>progTerminated</b>(<i>status</i>) 664 <b>progTerminated</b>(<i>status, message=""</i>)
651 <p> 665 <p>
652 Public method to tell the debugger that the program has terminated. 666 Public method to tell the debugger that the program has terminated.
653 </p><dl> 667 </p><dl>
654 <dt><i>status</i> (int)</dt> 668 <dt><i>status</i> (int)</dt>
655 <dd> 669 <dd>
656 return status 670 return status
671 </dd><dt><i>message</i> (str)</dt>
672 <dd>
673 status message
674 </dd>
675 </dl><a NAME="DebugClientBase.readReady" ID="DebugClientBase.readReady"></a>
676 <h4>DebugClientBase.readReady</h4>
677 <b>readReady</b>(<i>stream</i>)
678 <p>
679 Public method called when there is data ready to be read.
680 </p><dl>
681 <dt><i>stream</i></dt>
682 <dd>
683 file like object that has data to be written
657 </dd> 684 </dd>
658 </dl><a NAME="DebugClientBase.run_call" ID="DebugClientBase.run_call"></a> 685 </dl><a NAME="DebugClientBase.run_call" ID="DebugClientBase.run_call"></a>
659 <h4>DebugClientBase.run_call</h4> 686 <h4>DebugClientBase.run_call</h4>
660 <b>run_call</b>(<i>scriptname, func, *args</i>) 687 <b>run_call</b>(<i>scriptname, func, *args</i>)
661 <p> 688 <p>
674 </dl><dl> 701 </dl><dl>
675 <dt>Returns:</dt> 702 <dt>Returns:</dt>
676 <dd> 703 <dd>
677 result of the function call 704 result of the function call
678 </dd> 705 </dd>
706 </dl><a NAME="DebugClientBase.sendCallTrace" ID="DebugClientBase.sendCallTrace"></a>
707 <h4>DebugClientBase.sendCallTrace</h4>
708 <b>sendCallTrace</b>(<i>event, fromInfo, toInfo</i>)
709 <p>
710 Public method to send a call trace entry.
711 </p><dl>
712 <dt><i>event</i> (str)</dt>
713 <dd>
714 trace event (call or return)
715 </dd><dt><i>fromInfo</i> (dict with 'filename', 'linenumber' and 'codename')</dt>
716 <dd>
717 dictionary containing the origin info
718 as keys
719 </dd><dt><i>toInfo</i> (dict with 'filename', 'linenumber' and 'codename')</dt>
720 <dd>
721 dictionary containing the target info
722 as keys
723 </dd>
724 </dl><a NAME="DebugClientBase.sendClearTemporaryBreakpoint" ID="DebugClientBase.sendClearTemporaryBreakpoint"></a>
725 <h4>DebugClientBase.sendClearTemporaryBreakpoint</h4>
726 <b>sendClearTemporaryBreakpoint</b>(<i>filename, lineno</i>)
727 <p>
728 Public method to signal the deletion of a temporary breakpoint.
729 </p><dl>
730 <dt><i>filename</i> (str)</dt>
731 <dd>
732 name of the file the bp belongs to
733 </dd><dt><i>lineno</i> (int)</dt>
734 <dd>
735 linenumber of the bp
736 </dd>
737 </dl><a NAME="DebugClientBase.sendClearTemporaryWatch" ID="DebugClientBase.sendClearTemporaryWatch"></a>
738 <h4>DebugClientBase.sendClearTemporaryWatch</h4>
739 <b>sendClearTemporaryWatch</b>(<i>condition</i>)
740 <p>
741 Public method to signal the deletion of a temporary watch expression.
742 </p><dl>
743 <dt><i>condition</i> (str)</dt>
744 <dd>
745 condition of the watch expression to be cleared
746 </dd>
747 </dl><a NAME="DebugClientBase.sendException" ID="DebugClientBase.sendException"></a>
748 <h4>DebugClientBase.sendException</h4>
749 <b>sendException</b>(<i>exceptionType, exceptionMessage, stack</i>)
750 <p>
751 Public method to send information for an exception.
752 </p><dl>
753 <dt><i>exceptionType</i> (str)</dt>
754 <dd>
755 type of exception raised
756 </dd><dt><i>exceptionMessage</i> (str)</dt>
757 <dd>
758 message of the exception
759 </dd><dt><i>stack</i> (list)</dt>
760 <dd>
761 stack trace information
762 </dd>
763 </dl><a NAME="DebugClientBase.sendJsonCommand" ID="DebugClientBase.sendJsonCommand"></a>
764 <h4>DebugClientBase.sendJsonCommand</h4>
765 <b>sendJsonCommand</b>(<i>method, params</i>)
766 <p>
767 Public method to send a single command or response to the IDE.
768 </p><dl>
769 <dt><i>method</i> (str)</dt>
770 <dd>
771 command or response command name to be sent
772 </dd><dt><i>params</i> (dict)</dt>
773 <dd>
774 dictionary of named parameters for the command or
775 response
776 </dd>
777 </dl><a NAME="DebugClientBase.sendPassiveStartup" ID="DebugClientBase.sendPassiveStartup"></a>
778 <h4>DebugClientBase.sendPassiveStartup</h4>
779 <b>sendPassiveStartup</b>(<i>filename, exceptions</i>)
780 <p>
781 Public method to send the passive start information.
782 </p><dl>
783 <dt><i>filename</i> (str)</dt>
784 <dd>
785 name of the script
786 </dd><dt><i>exceptions</i> (bool)</dt>
787 <dd>
788 flag to enable exception reporting of the IDE
789 </dd>
790 </dl><a NAME="DebugClientBase.sendResponseLine" ID="DebugClientBase.sendResponseLine"></a>
791 <h4>DebugClientBase.sendResponseLine</h4>
792 <b>sendResponseLine</b>(<i>stack</i>)
793 <p>
794 Public method to send the current call stack.
795 </p><dl>
796 <dt><i>stack</i> (list)</dt>
797 <dd>
798 call stack
799 </dd>
800 </dl><a NAME="DebugClientBase.sendSyntaxError" ID="DebugClientBase.sendSyntaxError"></a>
801 <h4>DebugClientBase.sendSyntaxError</h4>
802 <b>sendSyntaxError</b>(<i>message, filename, lineno, charno</i>)
803 <p>
804 Public method to send information for a syntax error.
805 </p><dl>
806 <dt><i>message</i> (str)</dt>
807 <dd>
808 syntax error message
809 </dd><dt><i>filename</i> (str)</dt>
810 <dd>
811 name of the faulty file
812 </dd><dt><i>lineno</i> (int)</dt>
813 <dd>
814 line number info
815 </dd><dt><i>charno</i> (int)</dt>
816 <dd>
817 character number info
818 </dd>
679 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a> 819 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a>
680 <h4>DebugClientBase.sessionClose</h4> 820 <h4>DebugClientBase.sessionClose</h4>
681 <b>sessionClose</b>(<i>exit=True</i>) 821 <b>sessionClose</b>(<i>exit=True</i>)
682 <p> 822 <p>
683 Public method to close the session with the debugger and optionally 823 Public method to close the session with the debugger and optionally
764 </dd><dt><i>redirect</i></dt> 904 </dd><dt><i>redirect</i></dt>
765 <dd> 905 <dd>
766 flag indicating redirection of stdin, stdout and 906 flag indicating redirection of stdin, stdout and
767 stderr (boolean) 907 stderr (boolean)
768 </dd> 908 </dd>
769 </dl><a NAME="DebugClientBase.write" ID="DebugClientBase.write"></a> 909 </dl><a NAME="DebugClientBase.writeReady" ID="DebugClientBase.writeReady"></a>
770 <h4>DebugClientBase.write</h4> 910 <h4>DebugClientBase.writeReady</h4>
771 <b>write</b>(<i>s</i>) 911 <b>writeReady</b>(<i>stream</i>)
772 <p> 912 <p>
773 Public method to write data to the output stream. 913 Public method called when we are ready to write data.
774 </p><dl> 914 </p><dl>
775 <dt><i>s</i></dt> 915 <dt><i>stream</i></dt>
776 <dd> 916 <dd>
777 data to be written (string) 917 file like object that has data to be written
778 </dd> 918 </dd>
779 </dl> 919 </dl>
780 <div align="right"><a href="#top">Up</a></div> 920 <div align="right"><a href="#top">Up</a></div>
781 <hr /><hr /> 921 <hr /><hr />
782 <a NAME="DebugClientClose" ID="DebugClientClose"></a> 922 <a NAME="DebugClientClose" ID="DebugClientClose"></a>

eric ide

mercurial