|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.DebugClients.Ruby.DebugClientBaseModule</title> |
|
6 <style> |
|
7 b'body {\n background:white;\n margin: 0em 1em 10em 1em;\n color: black;\n}\n\nh1 { color: white; background: #4FA4FF; }\nh2 { color: white; background: #4FA4FF; }\nh3 { color: white; background: #00557F; }\nh4 { color: white; background: #00557F; }\n \na { color: #AA5500; }\n' |
|
8 </style> |
|
9 </head> |
|
10 <body><a NAME="top" ID="top"></a> |
|
11 <h1>eric5.DebugClients.Ruby.DebugClientBaseModule</h1> |
|
12 <p> |
|
13 File implementing a debug client base module. |
|
14 </p> |
|
15 <h3>Global Attributes</h3> |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr><td>None</td></tr> |
|
22 </table> |
|
23 <h3>Modules</h3> |
|
24 <table> |
|
25 <tr> |
|
26 <td><a href="#DebugClientBase">DebugClientBase</a></td> |
|
27 <td>Module implementing the client side of the debugger.</td> |
|
28 </tr> |
|
29 </table> |
|
30 <h3>Functions</h3> |
|
31 <table> |
|
32 <tr><td>None</td></tr> |
|
33 </table> |
|
34 <hr /><hr /> |
|
35 <a NAME="DebugClientBase" ID="DebugClientBase"></a> |
|
36 <h2>DebugClientBase</h2> |
|
37 <p> |
|
38 Module implementing the client side of the debugger. |
|
39 </p><p> |
|
40 It provides access to the Ruby interpeter from a debugger running in another |
|
41 process. |
|
42 </p><p> |
|
43 The protocol between the debugger and the client assumes that there will be |
|
44 a single source of debugger commands and a single source of Ruby |
|
45 statements. Commands and statement are always exactly one line and may be |
|
46 interspersed. |
|
47 </p><p> |
|
48 The protocol is as follows. First the client opens a connection to the |
|
49 debugger and then sends a series of one line commands. A command is either |
|
50 &gt;Load&lt;, &gt;Step&lt;, &gt;StepInto&lt;, ... or a Ruby statement. |
|
51 See DebugProtocol.rb for a listing of valid protocol tokens. |
|
52 </p><p> |
|
53 A Ruby statement consists of the statement to execute, followed (in a |
|
54 separate line) by &gt;OK?&lt;. If the statement was incomplete then the response |
|
55 is &gt;Continue&lt;. If there was an exception then the response is &gt;Exception&lt;. |
|
56 Otherwise the response is &gt;OK&lt;. The reason for the &gt;OK?&lt; part is to |
|
57 provide a sentinal (ie. the responding &gt;OK&lt;) after any possible output as a |
|
58 result of executing the command. |
|
59 </p><p> |
|
60 The client may send any other lines at any other time which should be |
|
61 interpreted as program output. |
|
62 </p><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><p> |
|
67 <b>Note</b>: This module is meant to be mixed in by individual DebugClient classes. |
|
68 Do not use it directly. |
|
69 </p> |
|
70 <h3>Module Attributes</h3> |
|
71 <table> |
|
72 <tr><td>@@clientCapabilities</td></tr> |
|
73 </table> |
|
74 <h3>Classes</h3> |
|
75 <table> |
|
76 <tr><td>None</td></tr> |
|
77 </table> |
|
78 <h3>Functions</h3> |
|
79 <table> |
|
80 <tr> |
|
81 <td><a href="#DebugClientBase.canEval?">canEval?</a></td> |
|
82 <td>Private method to check if the buffer's contents can be evaluated.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#DebugClientBase.completionList">completionList</a></td> |
|
85 <td>Method used to handle the command completion request</td> |
|
86 </tr><tr> |
|
87 <td><a href="#DebugClientBase.connectDebugger">connectDebugger</a></td> |
|
88 <td>Public method to establish a session with the debugger.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#DebugClientBase.dumpVariable">dumpVariable</a></td> |
|
91 <td>Private method to return the variables of a frame to the debug server.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#DebugClientBase.dumpVariables">dumpVariables</a></td> |
|
94 <td>Private method to return the variables of a frame to the debug server.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#DebugClientBase.eventLoop">eventLoop</a></td> |
|
97 <td>Private method implementing our event loop.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#DebugClientBase.eventPoll">eventPoll</a></td> |
|
100 <td>Private method to poll for events like 'set break point'.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#DebugClientBase.extractAddress">extractAddress</a></td> |
|
103 <td>Private method to extract the address part of an object description.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#DebugClientBase.extractTypeAndAddress">extractTypeAndAddress</a></td> |
|
106 <td>Private method to extract the address and type parts of an object description.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#DebugClientBase.formatVariablesList">formatVariablesList</a></td> |
|
109 <td>Private method to produce a formated variables list.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#DebugClientBase.generateFilterObjects">generateFilterObjects</a></td> |
|
112 <td>Private method to convert a filter string to a list of filter objects.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#DebugClientBase.handleException">handleException</a></td> |
|
115 <td>Private method called in the case of an exception</td> |
|
116 </tr><tr> |
|
117 <td><a href="#DebugClientBase.handleLine">handleLine</a></td> |
|
118 <td>Private method to handle the receipt of a complete line.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#DebugClientBase.inFilter?">inFilter?</a></td> |
|
121 <td>Private method to check, if a variable is to be filtered based on its type.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#DebugClientBase.initializeDebugClient">initializeDebugClient</a></td> |
|
124 <td>Method to initialize the module</td> |
|
125 </tr><tr> |
|
126 <td><a href="#DebugClientBase.interact">interact</a></td> |
|
127 <td>Private method to Interact with the debugger.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#DebugClientBase.main">main</a></td> |
|
130 <td>Public method implementing the main method.</td> |
|
131 </tr><tr> |
|
132 <td><a href="#DebugClientBase.progTerminated">progTerminated</a></td> |
|
133 <td>Private method to tell the debugger that the program has terminated.</td> |
|
134 </tr><tr> |
|
135 <td><a href="#DebugClientBase.sessionClose">sessionClose</a></td> |
|
136 <td>Privat method to close the session with the debugger and terminate.</td> |
|
137 </tr><tr> |
|
138 <td><a href="#DebugClientBase.startProgInDebugger">startProgInDebugger</a></td> |
|
139 <td>Method used to start the remote debugger.</td> |
|
140 </tr><tr> |
|
141 <td><a href="#DebugClientBase.trace_func">trace_func</a></td> |
|
142 <td>Method executed by the tracing facility.</td> |
|
143 </tr><tr> |
|
144 <td><a href="#DebugClientBase.unhandled_exception">unhandled_exception</a></td> |
|
145 <td>Private method to report an unhandled exception.</td> |
|
146 </tr><tr> |
|
147 <td><a href="#DebugClientBase.write">write</a></td> |
|
148 <td>Private method to write data to the output stream.</td> |
|
149 </tr> |
|
150 </table> |
|
151 <hr /> |
|
152 |
|
153 <a NAME="DebugClientBase.canEval?" ID="DebugClientBase.canEval?"></a> |
|
154 <h4>DebugClientBase.canEval?</h4> |
|
155 <b>canEval?</b>(<i></i>) |
|
156 <p> |
|
157 Private method to check if the buffer's contents can be evaluated. |
|
158 </p><dl> |
|
159 <dt>Returns:</dt> |
|
160 <dd> |
|
161 flag indicating if an eval might succeed (boolean) |
|
162 </dd> |
|
163 </dl><a NAME="DebugClientBase.completionList" ID="DebugClientBase.completionList"></a> |
|
164 <h4>DebugClientBase.completionList</h4> |
|
165 <b>completionList</b>(<i></i>) |
|
166 <p> |
|
167 Method used to handle the command completion request |
|
168 </p><dl> |
|
169 <dt><i>text</i></dt> |
|
170 <dd> |
|
171 the text to be completed (string) |
|
172 </dd> |
|
173 </dl><a NAME="DebugClientBase.connectDebugger" ID="DebugClientBase.connectDebugger"></a> |
|
174 <h4>DebugClientBase.connectDebugger</h4> |
|
175 <b>connectDebugger</b>(<i>remoteAddress=nil, redirect=true</i>) |
|
176 <p> |
|
177 Public method to establish a session with the debugger. |
|
178 </p><p> |
|
179 It opens a network connection to the debugger, connects it to stdin, |
|
180 stdout and stderr and saves these file objects in case the application |
|
181 being debugged redirects them itself. |
|
182 </p><dl> |
|
183 <dt><i>port</i></dt> |
|
184 <dd> |
|
185 the port number to connect to (int) |
|
186 </dd><dt><i>remoteAddress</i></dt> |
|
187 <dd> |
|
188 the network address of the debug server host (string) |
|
189 </dd><dt><i>redirect</i></dt> |
|
190 <dd> |
|
191 flag indicating redirection of stdin, stdout and stderr (boolean) |
|
192 </dd> |
|
193 </dl><a NAME="DebugClientBase.dumpVariable" ID="DebugClientBase.dumpVariable"></a> |
|
194 <h4>DebugClientBase.dumpVariable</h4> |
|
195 <b>dumpVariable</b>(<i>frmnr, scope, filter</i>) |
|
196 <p> |
|
197 Private method to return the variables of a frame to the debug server. |
|
198 </p><dl> |
|
199 <dt><i>var</i></dt> |
|
200 <dd> |
|
201 list encoded name of the requested variable (list of strings) |
|
202 </dd><dt><i>frmnr</i></dt> |
|
203 <dd> |
|
204 distance of frame reported on. 0 is the current frame (int) |
|
205 </dd><dt><i>scope</i></dt> |
|
206 <dd> |
|
207 1 to report global variables, 0 for local variables (int) |
|
208 </dd><dt><i>filter</i></dt> |
|
209 <dd> |
|
210 the indices of variable types to be filtered (list of int) |
|
211 </dd> |
|
212 </dl><a NAME="DebugClientBase.dumpVariables" ID="DebugClientBase.dumpVariables"></a> |
|
213 <h4>DebugClientBase.dumpVariables</h4> |
|
214 <b>dumpVariables</b>(<i>scope, filter</i>) |
|
215 <p> |
|
216 Private method to return the variables of a frame to the debug server. |
|
217 </p><dl> |
|
218 <dt><i>frmnr</i></dt> |
|
219 <dd> |
|
220 distance of frame reported on. 0 is the current frame (int) |
|
221 </dd><dt><i>scope</i></dt> |
|
222 <dd> |
|
223 1 to report global variables, 0 for local variables (int) |
|
224 </dd><dt><i>filter</i></dt> |
|
225 <dd> |
|
226 the indices of variable types to be filtered (list of int) |
|
227 </dd> |
|
228 </dl><a NAME="DebugClientBase.eventLoop" ID="DebugClientBase.eventLoop"></a> |
|
229 <h4>DebugClientBase.eventLoop</h4> |
|
230 <b>eventLoop</b>(<i></i>) |
|
231 <p> |
|
232 Private method implementing our event loop. |
|
233 </p><a NAME="DebugClientBase.eventPoll" ID="DebugClientBase.eventPoll"></a> |
|
234 <h4>DebugClientBase.eventPoll</h4> |
|
235 <b>eventPoll</b>(<i></i>) |
|
236 <p> |
|
237 Private method to poll for events like 'set break point'. |
|
238 </p><a NAME="DebugClientBase.extractAddress" ID="DebugClientBase.extractAddress"></a> |
|
239 <h4>DebugClientBase.extractAddress</h4> |
|
240 <b>extractAddress</b>(<i></i>) |
|
241 <p> |
|
242 Private method to extract the address part of an object description. |
|
243 </p><dl> |
|
244 <dt><i>var</i></dt> |
|
245 <dd> |
|
246 object description (String) |
|
247 </dd> |
|
248 </dl><dl> |
|
249 <dt>Returns:</dt> |
|
250 <dd> |
|
251 the address contained in the object description (String) |
|
252 </dd> |
|
253 </dl><a NAME="DebugClientBase.extractTypeAndAddress" ID="DebugClientBase.extractTypeAndAddress"></a> |
|
254 <h4>DebugClientBase.extractTypeAndAddress</h4> |
|
255 <b>extractTypeAndAddress</b>(<i></i>) |
|
256 <p> |
|
257 Private method to extract the address and type parts of an object description. |
|
258 </p><dl> |
|
259 <dt><i>var</i></dt> |
|
260 <dd> |
|
261 object description (String) |
|
262 </dd> |
|
263 </dl><dl> |
|
264 <dt>Returns:</dt> |
|
265 <dd> |
|
266 list containing the type and address contained in the object |
|
267 description (Array of two String) |
|
268 </dd> |
|
269 </dl><a NAME="DebugClientBase.formatVariablesList" ID="DebugClientBase.formatVariablesList"></a> |
|
270 <h4>DebugClientBase.formatVariablesList</h4> |
|
271 <b>formatVariablesList</b>(<i>binding_, scope, filter = [], excludeSelf = false, access = nil</i>) |
|
272 <p> |
|
273 Private method to produce a formated variables list. |
|
274 </p><p> |
|
275 The binding passed in to it is scanned. Variables are |
|
276 only added to the list, if their type is not contained |
|
277 in the filter list and their name doesn't match any of the filter expressions. |
|
278 The formated variables list (a list of lists of 3 values) is returned. |
|
279 </p><dl> |
|
280 <dt><i>keylist</i></dt> |
|
281 <dd> |
|
282 keys of the dictionary |
|
283 </dd><dt><i>binding_</i></dt> |
|
284 <dd> |
|
285 the binding to be scanned |
|
286 </dd><dt><i>scope</i></dt> |
|
287 <dd> |
|
288 1 to filter using the globals filter, 0 using the locals filter (int). |
|
289 Variables are only added to the list, if their name do not match any of the |
|
290 filter expressions. |
|
291 </dd><dt><i>filter</i></dt> |
|
292 <dd> |
|
293 the indices of variable types to be filtered. Variables are |
|
294 only added to the list, if their type is not contained in the filter |
|
295 list. |
|
296 </dd><dt><i>excludeSelf</i></dt> |
|
297 <dd> |
|
298 flag indicating if the self object should be excluded from |
|
299 the listing (boolean) |
|
300 </dd><dt><i>access</i></dt> |
|
301 <dd> |
|
302 String specifying the access path to (String) |
|
303 </dd> |
|
304 </dl><dl> |
|
305 <dt>Returns:</dt> |
|
306 <dd> |
|
307 A list consisting of a list of formatted variables. Each variable |
|
308 entry is a list of three elements, the variable name, its type and |
|
309 value. |
|
310 </dd> |
|
311 </dl><a NAME="DebugClientBase.generateFilterObjects" ID="DebugClientBase.generateFilterObjects"></a> |
|
312 <h4>DebugClientBase.generateFilterObjects</h4> |
|
313 <b>generateFilterObjects</b>(<i>filterString</i>) |
|
314 <p> |
|
315 Private method to convert a filter string to a list of filter objects. |
|
316 </p><dl> |
|
317 <dt><i>scope</i></dt> |
|
318 <dd> |
|
319 1 to generate filter for global variables, 0 for local variables (int) |
|
320 </dd><dt><i>filterString</i></dt> |
|
321 <dd> |
|
322 string of filter patterns separated by ';' |
|
323 </dd> |
|
324 </dl><a NAME="DebugClientBase.handleException" ID="DebugClientBase.handleException"></a> |
|
325 <h4>DebugClientBase.handleException</h4> |
|
326 <b>handleException</b>(<i></i>) |
|
327 <p> |
|
328 Private method called in the case of an exception |
|
329 </p><p> |
|
330 It ensures that the debug server is informed of the raised exception. |
|
331 </p><a NAME="DebugClientBase.handleLine" ID="DebugClientBase.handleLine"></a> |
|
332 <h4>DebugClientBase.handleLine</h4> |
|
333 <b>handleLine</b>(<i></i>) |
|
334 <p> |
|
335 Private method to handle the receipt of a complete line. |
|
336 </p><p> |
|
337 It first looks for a valid protocol token at the start of the line. Thereafter |
|
338 it trys to execute the lines accumulated so far. |
|
339 </p><dl> |
|
340 <dt><i>line</i></dt> |
|
341 <dd> |
|
342 the received line |
|
343 </dd> |
|
344 </dl><a NAME="DebugClientBase.inFilter?" ID="DebugClientBase.inFilter?"></a> |
|
345 <h4>DebugClientBase.inFilter?</h4> |
|
346 <b>inFilter?</b>(<i>otype, oval</i>) |
|
347 <p> |
|
348 Private method to check, if a variable is to be filtered based on its type. |
|
349 </p><dl> |
|
350 <dt><i>filter</i></dt> |
|
351 <dd> |
|
352 the indices of variable types to be filtered (Array of int. |
|
353 </dd><dt><i>otype</i></dt> |
|
354 <dd> |
|
355 type of the variable to be checked (String) |
|
356 </dd><dt><i>oval</i></dt> |
|
357 <dd> |
|
358 variable value to be checked (String) |
|
359 </dd> |
|
360 </dl><dl> |
|
361 <dt>Returns:</dt> |
|
362 <dd> |
|
363 flag indicating, whether the variable should be filtered (boolean) |
|
364 </dd> |
|
365 </dl><a NAME="DebugClientBase.initializeDebugClient" ID="DebugClientBase.initializeDebugClient"></a> |
|
366 <h4>DebugClientBase.initializeDebugClient</h4> |
|
367 <b>initializeDebugClient</b>(<i></i>) |
|
368 <p> |
|
369 Method to initialize the module |
|
370 </p><a NAME="DebugClientBase.interact" ID="DebugClientBase.interact"></a> |
|
371 <h4>DebugClientBase.interact</h4> |
|
372 <b>interact</b>(<i></i>) |
|
373 <p> |
|
374 Private method to Interact with the debugger. |
|
375 </p><a NAME="DebugClientBase.main" ID="DebugClientBase.main"></a> |
|
376 <h4>DebugClientBase.main</h4> |
|
377 <b>main</b>(<i></i>) |
|
378 <p> |
|
379 Public method implementing the main method. |
|
380 </p><a NAME="DebugClientBase.progTerminated" ID="DebugClientBase.progTerminated"></a> |
|
381 <h4>DebugClientBase.progTerminated</h4> |
|
382 <b>progTerminated</b>(<i></i>) |
|
383 <p> |
|
384 Private method to tell the debugger that the program has terminated. |
|
385 </p><dl> |
|
386 <dt><i>status</i></dt> |
|
387 <dd> |
|
388 the return status |
|
389 </dd> |
|
390 </dl><a NAME="DebugClientBase.sessionClose" ID="DebugClientBase.sessionClose"></a> |
|
391 <h4>DebugClientBase.sessionClose</h4> |
|
392 <b>sessionClose</b>(<i></i>) |
|
393 <p> |
|
394 Privat method to close the session with the debugger and terminate. |
|
395 </p><a NAME="DebugClientBase.startProgInDebugger" ID="DebugClientBase.startProgInDebugger"></a> |
|
396 <h4>DebugClientBase.startProgInDebugger</h4> |
|
397 <b>startProgInDebugger</b>(<i>wd = '', host = nil, port = nil, exceptions = true, traceRuby = false, redirect=true</i>) |
|
398 <p> |
|
399 Method used to start the remote debugger. |
|
400 </p><dl> |
|
401 <dt><i>progargs</i></dt> |
|
402 <dd> |
|
403 commandline for the program to be debugged |
|
404 (list of strings) |
|
405 </dd><dt><i>wd</i></dt> |
|
406 <dd> |
|
407 working directory for the program execution (string) |
|
408 </dd><dt><i>host</i></dt> |
|
409 <dd> |
|
410 hostname of the debug server (string) |
|
411 </dd><dt><i>port</i></dt> |
|
412 <dd> |
|
413 portnumber of the debug server (int) |
|
414 </dd><dt><i>exceptions</i></dt> |
|
415 <dd> |
|
416 flag to enable exception reporting of the IDE (boolean) |
|
417 </dd><dt><i>traceRuby</i></dt> |
|
418 <dd> |
|
419 flag to enable tracing into the Ruby library |
|
420 </dd><dt><i>redirect</i></dt> |
|
421 <dd> |
|
422 flag indicating redirection of stdin, stdout and stderr (boolean) |
|
423 </dd> |
|
424 </dl><a NAME="DebugClientBase.trace_func" ID="DebugClientBase.trace_func"></a> |
|
425 <h4>DebugClientBase.trace_func</h4> |
|
426 <b>trace_func</b>(<i>file, line, id, binding_, klass</i>) |
|
427 <p> |
|
428 Method executed by the tracing facility. |
|
429 </p><p> |
|
430 It is used to save the execution context of an exception. |
|
431 </p><dl> |
|
432 <dt><i>event</i></dt> |
|
433 <dd> |
|
434 the tracing event (String) |
|
435 </dd><dt><i>file</i></dt> |
|
436 <dd> |
|
437 the name of the file being traced (String) |
|
438 </dd><dt><i>line</i></dt> |
|
439 <dd> |
|
440 the line number being traced (int) |
|
441 </dd><dt><i>id</i></dt> |
|
442 <dd> |
|
443 object id |
|
444 </dd><dt><i>binding_</i></dt> |
|
445 <dd> |
|
446 a binding object |
|
447 </dd><dt><i>klass</i></dt> |
|
448 <dd> |
|
449 name of a class |
|
450 </dd> |
|
451 </dl><a NAME="DebugClientBase.unhandled_exception" ID="DebugClientBase.unhandled_exception"></a> |
|
452 <h4>DebugClientBase.unhandled_exception</h4> |
|
453 <b>unhandled_exception</b>(<i></i>) |
|
454 <p> |
|
455 Private method to report an unhandled exception. |
|
456 </p><dl> |
|
457 <dt><i>exc</i></dt> |
|
458 <dd> |
|
459 the exception object |
|
460 </dd> |
|
461 </dl><a NAME="DebugClientBase.write" ID="DebugClientBase.write"></a> |
|
462 <h4>DebugClientBase.write</h4> |
|
463 <b>write</b>(<i></i>) |
|
464 <p> |
|
465 Private method to write data to the output stream. |
|
466 </p><dl> |
|
467 <dt><i>s</i></dt> |
|
468 <dd> |
|
469 data to be written (string) |
|
470 </dd> |
|
471 </dl> |
|
472 <div align="right"><a href="#top">Up</a></div> |
|
473 <hr /> |
|
474 </body></html> |